diff --git a/app_new/core/routes/admin.py b/app_new/core/routes/admin.py index 2cd3993..f8679c5 100644 --- a/app_new/core/routes/admin.py +++ b/app_new/core/routes/admin.py @@ -417,13 +417,18 @@ def template_debug(): """Affiche les doublons et les décisions de nettoyage des templates.""" files, by_key = _template_inventory() selected_filter = request.args.get('filter', 'duplicates') + treated = lambda item: item['mark'] and item['mark'].status == 'obsolete' if selected_filter == 'obsolete': visible_files = [item for item in files if item['mark'] and item['mark'].status == 'obsolete'] + elif selected_filter == 'identical': + visible_files = [item for item in files if not treated(item) and item['duplicate_count'] > 1 and item['comparison'] == 'identique'] + elif selected_filter == 'divergent': + visible_files = [item for item in files if not treated(item) and item['duplicate_count'] > 1 and item['comparison'] == 'divergent'] elif selected_filter == 'all': - visible_files = files + visible_files = [item for item in files if not treated(item)] else: selected_filter = 'duplicates' - visible_files = [item for item in files if item['duplicate_count'] > 1] + visible_files = [item for item in files if not treated(item) and item['duplicate_count'] > 1] stats = { 'total': len(files), 'duplicate_groups': sum(1 for group in by_key.values() if len(group) > 1), diff --git a/app_new/templates/admin/template_debug.html b/app_new/templates/admin/template_debug.html index ceea88e..4f864e3 100644 --- a/app_new/templates/admin/template_debug.html +++ b/app_new/templates/admin/template_debug.html @@ -43,10 +43,15 @@ {% endfor %} -
- Doublons - Obsolètes - Tous +
+ Afficher : +
{% if groups %} diff --git a/app_new/templates/base.html b/app_new/templates/base.html index 7c4c5f5..ecee441 100644 --- a/app_new/templates/base.html +++ b/app_new/templates/base.html @@ -111,25 +111,25 @@
- + {% set unread = stats.alerts_unread if stats is defined else 0 %} - {% if unread %} - - - + + + {% if unread %} + {{ unread }} + {% endif %} - {% endif %} - - - + + + diff --git a/tests/integration/test_intervention_location_and_template_audit.py b/tests/integration/test_intervention_location_and_template_audit.py index c398f77..2924282 100644 --- a/tests/integration/test_intervention_location_and_template_audit.py +++ b/tests/integration/test_intervention_location_and_template_audit.py @@ -7,6 +7,8 @@ def test_template_audit_can_mark_and_restore_without_deleting(authenticated_clie assert 'Audit des templates' in response.get_data(as_text=True) assert 'Architecture cible des templates' in response.get_data(as_text=True) assert 'app_new/chatbot/templates/chatbot/index.html' in response.get_data(as_text=True) + assert 'Identiques' in response.get_data(as_text=True) + assert 'Divergents' in response.get_data(as_text=True) response = authenticated_client.get('/admin/debug/templates/preview?path=templates%2Fadmin%2Ftemplate_debug.html') assert response.status_code == 200