Commit 4f37e535 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Display body errors only if no structure errors

parent 8034f2fb
...@@ -45,8 +45,6 @@ ...@@ -45,8 +45,6 @@
{% if report.table.errors.structure %} {% if report.table.errors.structure %}
<div> <div>
<h3>Problèmes de structure</h3> <h3>Problèmes de structure</h3>
{{ report.table.errors.structure|length }} erreur(s) détectée(s)
{% for err in report.table.errors.structure %} {% for err in report.table.errors.structure %}
<div class="alert alert-danger"> <div class="alert alert-danger">
{{ err.message | safe}} {{ err.message | safe}}
...@@ -58,9 +56,12 @@ ...@@ -58,9 +56,12 @@
<!-- row checks --> <!-- row checks -->
{% if report.table.errors.body %} {% if report.table.errors.body %}
{% if not report.table.display_body_errors %}
Merci de corriger ce(s) erreur(s) pour visualiser les erreurs de contenu.
{% else %}
<div> <div>
<h3>Problèmes de contenu</h3> <h3>Problèmes de contenu</h3>
{{ report.table.errors.body|length }} erreur(s) détectée(s)
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table-sm table-bordered table-striped table-hover"> <table class="table-sm table-bordered table-striped table-hover">
<thead class="thead-light"> <thead class="thead-light">
...@@ -100,18 +101,11 @@ ...@@ -100,18 +101,11 @@
</tbody> </tbody>
</table> </table>
</div> </div>
{% endif %}
{% endif %} {% endif %}
</div> </div>
<!--
<pre>
{{ report_str | safe }}
</pre>
-->
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block footer %} {% block footer %}
...@@ -127,4 +121,10 @@ ...@@ -127,4 +121,10 @@
}) })
}) })
</script> </script>
{#
{{ 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
...@@ -156,6 +156,12 @@ def create_validata_report(goodtables_report, schema): ...@@ -156,6 +156,12 @@ def create_validata_report(goodtables_report, schema):
else: else:
report['table']['errors']['body'].append(err) report['table']['errors']['body'].append(err)
# If there are structure errors different to invalid-column-delimiter
# => don't display body errors
report['table']['display_body_errors'] = all(err['code'] == 'invalid-column-delimiter'
for err in report['table']['errors']['structure'])
if report['table']['display_body_errors']:
# and group body errors by row id # and group body errors by row id
rows = [] rows = []
current_row_id = 0 current_row_id = 0
......
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