Commit 3dbe90d1 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Display recommandations

parent fbf445de
......@@ -51,7 +51,13 @@
<div class="card">
<div class="card-body">
<h2 class="card-title">
Fichier {% if report.error_count == 0 %}valide{% else %}invalide{% endif %}
Fichier
{% if report.error_count == 0 %}
{% if report.warn_count != 0 %}partiellement{% endif %}
valide
{% else %}
invalide
{% endif %}
</h2>
{% if display_badge %}
......@@ -83,6 +89,15 @@
{% endif %}
</p>
{% endif %}
{% if report.warn_count != 0 %}
<p>
{% if report.warn_count == 1 %}
1 recommandation
{% else %}
{{ report.warn_count }} recommandations
{% endif %}
</p>
{% endif %}
</div>
</div>
</div>
......@@ -135,6 +150,14 @@
{# Display body errors #}
<div class="mx-4">
{% if report.table.warn_count != 0 %}
<h3 class="my-4">Recommandations</h3>
<ul>
{% for warn in report.warnings %}
<li>{{ warn.message | commonmark2html | safe}}</li>
{% endfor %}
</ul>
{% endif %}
<h3 class="my-4">
{% if report.table.errors.body %}
{% set value_errors = report.table['error-stats']['body-errors'] %}
......
......@@ -481,8 +481,10 @@ def create_validata_ui_report(validata_core_report, schema_dict):
# prepare error structure for UI needs
errors = build_ui_errors(v_report.table["errors"])
# Count errors
# Count errors and warnings
ui_report["error_count"] = len(errors)
ui_report["warn_count"] = len(v_report.table["structure_warnings"])
ui_report["warnings"] = v_report.table["structure_warnings"]
# Then group them in 2 groups : structure and body
ui_report["table"]["errors"] = {"structure": [], "body": []}
......
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