diff --git a/validata_ui/templates/validation_report.html b/validata_ui/templates/validation_report.html
index 431ddd94c5bb7ac7af23d39934a98f9bd8bce9bd..59436cee4dcd92bd163afe3644051773715dec9d 100644
--- a/validata_ui/templates/validation_report.html
+++ b/validata_ui/templates/validation_report.html
@@ -7,6 +7,7 @@
font-size: 1.2em;
font-weight: bold;
}
+
@media print {
.hidden-print {
display: none;
@@ -93,60 +94,77 @@
La table est invalide
+ {{ report.table['error-stats']['total'] }} erreur(s) détectée(s).
+
+ {% set structure_errors = report.table['error-stats']['structure-errors'] %}
+ {% if structure_errors['nb'] != 0 %}
+ Erreur(s) de structure ({{ structure_errors['nb'] }}) :
+
+ {% for elt in structure_errors['distribution'] %}
+ - {{ elt[0] }} ({{ elt[1] }})
+ {% endfor %}
+
+ {% endif %}
+
+ {% if report.table.do_display_body_errors %}
+ {% set value_errors = report.table['error-stats']['value-errors'] %}
+ {% if value_errors %}
+ {% if value_errors['nb'] != 0 %}
+ Erreur(s) de valeur ({{ value_errors['nb'] }}) :
+
+ {% for elt in value_errors['distribution'] %}
+ - {{ elt[0] }} ({{ elt[1] }})
+ {% endfor %}
+
+ {% endif %}
+ {% endif %}
+ {% endif %}
+
{# table checks #}
{% if report.table.errors.structure %}
-
Problèmes de structure
+
Structure
{% for err in report.table.errors.structure %}
{{ err.message | safe}}
{% endfor %}
+ {% else %}
+ Aucune erreur de structure
{% endif %}
+ {# We do display body errors! #}
+ {% if report.table.do_display_body_errors %}
+ Contenu
+
+ {# No errors - display preview #}
{% if not report.table.errors.body %}
- Problèmes de contenu
Aucune erreur de contenu
-
{{ tables.preview(source_data) }}
+
+ {% else %}
+ {# display errors #}
+ {{ tables.body_errors(report, source_data) }}
+
{% endif %}
- {% if report.table.errors.body %}
-
- {% if not report.table.display_body_errors %}
-
- Veuillez corriger ce(s) erreur(s) pour visualiser les problèmes de contenu.
-
-
+ {# do not display errors #}
+ {% else %}
- Affichez
- tout de même les problèmes de contenu
+ Veuillez corriger ce(s) erreur(s) pour visualiser les éventuels problèmes de contenu.
-
- Attention, en cas de problèmes de structure signalés ci-dessus, certains messages d'erreurs ne seront pas
- pertinents
-
-
-
- {{ tables.body_errors(report, source_data) }}
-
- {% else %}
-
- {{ tables.body_errors(report, source_data) }}
-
- {% endif %}
{% endif %}
- {% endif %}
{% endblock %}
+
{% block footer %}
-{#
-{{ report.table.errors.structure|length }} erreur(s) détectée(s)
-{{ report.table.errors.body|length }} erreur(s) détectée(s)
-
-#}
-{% endblock %}
+ {% endblock %}
\ No newline at end of file
diff --git a/validata_ui/views.py b/validata_ui/views.py
index a919599fb13ab908fe47cf9d3976a6ab29a6d44c..530e5e2667974a2134c3917bafd7e2af778b2783 100644
--- a/validata_ui/views.py
+++ b/validata_ui/views.py
@@ -139,8 +139,9 @@ def create_validata_report(goodtables_report, schema):
report['table']['errors']['body'].append(err)
# Checks if there are structure errors different to invalid-column-delimiter
- report['table']['display_body_errors'] = all(err['code'] == 'invalid-column-delimiter'
- for err in report['table']['errors']['structure'])
+ structure_errors = report['table']['errors']['structure']
+ report['table']['do_display_body_errors'] = len(structure_errors) == 0 or \
+ all(err['code'] == 'invalid-column-delimiter' for err in structure_errors)
# Group body errors by row id
rows = []