Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Unknow" comment when the concept IS defined but no code provided. #559

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions web/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ def concept_code(self, concept_key):
:return: the string containing the concept's code
"""
code = self.concept(concept_key).get("code")
if not code:
return None
if isinstance(code, list):
code = "\n".join(code)
return code
Expand Down
4 changes: 3 additions & 1 deletion web/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,10 @@ def format_code_for_display(concept_key, lang):
:param lang: language to format it (in meta language/syntax highlighter format)
:return: string with code with applied HTML formatting
"""
if lang.concept_unknown(concept_key) or lang.concept_code(concept_key) is None:
if lang.concept_unknown(concept_key):
return "Unknown"
if lang.concept_code(concept_key) is None:
return None
if lang.concept_implemented(concept_key):
return highlight(
lang.concept_code(concept_key),
Expand Down