Skip to content

Commit

Permalink
Merge pull request #706 from ulyssear/features/draft-fixed
Browse files Browse the repository at this point in the history
Added message at top of page if thesaurus is incomplete
  • Loading branch information
geekygirlsarah authored Nov 28, 2023
2 parents 9da1713 + 3e17828 commit c46c2db
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
11 changes: 11 additions & 0 deletions web/templates/concepts.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ <h1 class="col-12">{{ title }}</h1>
the language column{{ languages | length | pluralize }} to correct any
information.
</p>
{% for lang in languages %}
{% if lang.is_incomplete %}
<div class="alert alert-link" role="alert">
{{ lang.name }} ({{ lang.version }})'s thesaurus is incomplete. Please help us improve by
<a href="https://github.com/codethesaurus/codethesaur.us/edit/main/web/thesauruses/{{ lang.key }}/{{ lang.version }}/{{ concept }}.json" rel="noopener">
adding or correcting information
</a>
for this language.
</div>
{% endif %}
{% endfor %}
</div>

{% for category in categories %}
Expand Down
30 changes: 26 additions & 4 deletions web/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,31 @@ def concepts(request):
for (category_key, category) in meta_structure.categories.items():
concepts_list = [concepts_data(key, name, languages) for (key, name) in category.items()]

all_categories.append({
category_entry = {
"key": category_key,
"concepts": concepts_list
})
"concepts": concepts_list,
"is_incomplete": [False] * len(languages)
}
for i in range(len(languages)):
is_incomplete = True
for concept in concepts_list:
if not languages[i].concept_unknown(concept["key"]) and \
languages[i].concept_implemented(concept["key"]):
is_incomplete = False
if languages[i].concept_unknown(concept["key"]) or \
(languages[i].concept_implemented(concept["key"]) and \
not languages[i].concept_code(concept["key"]) and \
not languages[i].concept_comment(concept["key"]) ):
category_entry["is_incomplete"][i] = True
break
if is_incomplete:
category_entry["is_incomplete"][i] = True
all_categories.append(category_entry)

for lang in languages:
booleans = [category["is_incomplete"][languages.index(lang)] for category in all_categories]
lang._is_incomplete = any(booleans)

return render_concepts(request, languages, meta_structure, all_categories)


Expand All @@ -217,7 +238,8 @@ def render_concepts(request, languages, structure, all_categories):
{
"key": language.key,
"version": language.version,
"name": language.name
"name": language.name,
"is_incomplete": language._is_incomplete,
}
for language in languages
],
Expand Down

0 comments on commit c46c2db

Please sign in to comment.