From 914775d0855b16faa4fd61dbf71d9830b17d283c Mon Sep 17 00:00:00 2001 From: Ulysse ARNAUD Date: Sat, 28 Oct 2023 17:26:42 +0200 Subject: [PATCH] Replaced alert in each category with at least one entry unknown to single alert for the language at the top of page --- web/templates/concepts.html | 19 +++++++++++-------- web/views.py | 8 +++++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/web/templates/concepts.html b/web/templates/concepts.html index 58e51414b..fb4a93b00 100644 --- a/web/templates/concepts.html +++ b/web/templates/concepts.html @@ -23,6 +23,17 @@

{{ title }}

the language column{{ languages | length | pluralize }} to correct any information.

+ {% for lang in languages %} + {% if lang.is_incomplete %} + + {% endif %} + {% endfor %} {% for category in categories %} @@ -38,14 +49,6 @@

Concept

{{ lang.name }}'s Implementation

- {% with i=forloop.counter %} - {% if category.is_incomplete|slice:i|last %} - - {% endif %} - {% endwith %}
{% endfor %} diff --git a/web/views.py b/web/views.py index cb8b1c42e..5e013fa34 100644 --- a/web/views.py +++ b/web/views.py @@ -194,7 +194,7 @@ def concepts(request): category_entry = { "key": category_key, "concepts": concepts_list, - "is_incomplete": [False for _ in languages], + "is_incomplete": [False] * len(languages) } for i in range(len(languages)): for concept in concepts_list: @@ -205,6 +205,11 @@ def concepts(request): category_entry["is_incomplete"][i] = True break 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) @@ -227,6 +232,7 @@ def render_concepts(request, languages, structure, all_categories): "key": language.key, "version": language.version, "name": language.name, + "is_incomplete": language._is_incomplete, } for language in languages ],