Commit aff19260 authored by Pierre Dittgen's avatar Pierre Dittgen

Display statistics

parent 7537e77e
......@@ -25,7 +25,6 @@
{% endmacro %}
{% macro body_errors(report, source_data) %}
<h3>Problèmes de contenu</h3>
<div class="table-responsive-sm">
<table class="table-sm table-bordered table-striped table-hover">
<thead class="thead-light">
......@@ -66,4 +65,30 @@
</tbody>
</table>
</div>
{% endmacro %}
{% macro error_statistics(report) %}
{% set structure_errors = report.table['error-stats']['structure-errors'] %}
{% if structure_errors['nb'] != 0 %}
Erreur(s) de structure ({{ structure_errors['nb'] }}) :
<ul>
{% for elt in structure_errors['distribution'] %}
<li>{{ elt[0] }} : {{ elt[1] }}</li>
{% endfor %}
</ul>
{% endif %}
{% if report.table.do_display_body_errors %}
{% set value_errors = report.table['error-stats']['value-errors'] %}
{% if value_errors['nb'] != 0 %}
Erreur(s) de contenu ({{ value_errors['nb'] }}) :
<ul>
{% for elt in value_errors['distribution'] %}
<li>{{ elt[0] }} : {{ elt[1] }}</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% endmacro %}
\ No newline at end of file
......@@ -19,13 +19,13 @@
{% if print_mode %}
<div class="row">
<div class="col-md-5">
{% endif %}
{% endif %}
<h1>{{ title }}</h1>
<p class="text">Validation effectuée {{ validation_date }}</p>
<p class="text alert alert-info hidden-print">
Pour relancer la validation, <a href="#" onclick="location.reload();">rechargez</a> la page.
</p>
{% if print_mode %}
{% if print_mode %}
</div>
<div class="col-md-7">
<img src="{{ url_for('static', filename='img/logo-horizontal.png') }}" height="80" alt="Validata" />
......@@ -34,7 +34,7 @@
{% endif %}
{% if source.type == 'url' %}
<p class="text hidden-print">Obtenir le rapport au format <a href="{{ url_for('pdf_report', val_code=val_info.code) }}?url={{source.name|urlencode}}">PDF</a>
{% endif %}
{% endif %}
{# Schema info #}
<div class="row">
<div class="col-md-{% if print_mode %}12{% else %}5{% endif %} my-4">
......@@ -82,13 +82,13 @@
</div>
</div>
{% import 'table_macros.html' as tables %}
{% import 'validation_macros.html' as macros %}
{% if report.error_count == 0 %}
<h2>La table est valide</h2>
<p>Aucune erreur détectée</p>
{{ tables.preview(source_data) }}
{{ macros.preview(source_data) }}
{% else %}
......@@ -96,35 +96,12 @@
<p class="text">{{ report.table['error-stats']['total'] }} erreur(s) détectée(s).</p>
{% set structure_errors = report.table['error-stats']['structure-errors'] %}
{% if structure_errors['nb'] != 0 %}
Erreur(s) de structure ({{ structure_errors['nb'] }}) :
<ul>
{% for elt in structure_errors['distribution'] %}
<li>{{ elt[0] }} ({{ elt[1] }})</li>
{% endfor %}
</ul>
{% 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'] }}) :
<ul>
{% for elt in value_errors['distribution'] %}
<li>{{ elt[0] }} ({{ elt[1] }})</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% endif %}
{{ macros.error_statistics(report) }}
{# table checks #}
{% if report.table.errors.structure %}
<div>
<h3>Structure</h3>
<h3>Problèmes de structure</h3>
{% for err in report.table.errors.structure %}
<div class="alert alert-danger">
{{ err.message | safe}}
......@@ -135,23 +112,21 @@
<p class="text">Aucune erreur de structure</p>
{% endif %}
<!-- row checks -->
{# We do display body errors! #}
{% if report.table.do_display_body_errors %}
<h3>Contenu</h3>
<h3>Problèmes de contenu</h3>
{# No errors - display preview #}
{% if not report.table.errors.body %}
<p class="text">
Aucune erreur de contenu
</p>
{{ tables.preview(source_data) }}
{{ macros.preview(source_data) }}
{% else %}
{# display errors #}
{{ tables.body_errors(report, source_data) }}
{{ macros.body_errors(report, source_data) }}
{% endif %}
......@@ -161,6 +136,7 @@
Veuillez corriger ce(s) erreur(s) pour visualiser les éventuels problèmes de contenu.
</p>
{% endif %}
{% endif %}
{% endblock %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment