Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alexandre Bulté
validata-ui
Commits
d5ce0e7d
Commit
d5ce0e7d
authored
Nov 29, 2018
by
Pierre Dittgen
Browse files
Improve column comparison messages
parent
41db51a8
Changes
2
Show whitespace changes
Inline
Side-by-side
validata_ui/templates/validation_report.html
View file @
d5ce0e7d
...
...
@@ -129,7 +129,7 @@
</tr>
</thead>
<tbody>
{% for elt in report.table.column_comparison_info %}
{% for elt in report.table.column_comparison_info
.table
%}
<tr
{%
if
elt[2] =
=
'
ko
'
%}
class=
"table-danger"
{%
endif
%}
>
<td>
{{ elt[0] }}
</td>
<td>
{{ elt[1] }}
</td>
...
...
@@ -137,7 +137,12 @@
{% endfor %}
</tbody>
</table>
{% if report.table.column_comparison_info.has_missing %}
<p>
Attention : toutes les colonnes attendues doivent être présentes dans le fichier à valider.
<p>
{% endif %}
{% if report.table.column_comparison_info.has_case_errors %}
<p>
Attention : la casse (minuscules/majuscules) doit être respectée dans les noms de colonne.
<p>
{% endif %}
{% endif %}
{% endif %}
...
...
validata_ui/views.py
View file @
d5ce0e7d
...
...
@@ -154,11 +154,18 @@ def create_validata_ui_report(validata_core_report, schema):
if
column_comparison_needed
:
column_comparison_table
=
[]
field_names
=
[
f
[
'name'
]
for
f
in
schema_fields
]
has_case_errors
=
False
for
t
in
itertools
.
zip_longest
(
headers
,
field_names
,
fillvalue
=
''
):
status
=
'ok'
if
t
[
0
]
==
t
[
1
]
else
'ko'
if
not
has_case_errors
and
status
==
'ko'
and
t
[
0
].
lower
()
==
t
[
1
].
lower
():
has_case_errors
=
True
column_comparison_table
.
append
((
*
t
,
status
))
info
=
{}
info
[
'table'
]
=
column_comparison_table
info
[
'has_missing'
]
=
len
(
headers
)
<
len
(
field_names
)
info
[
'has_case_errors'
]
=
has_case_errors
report
[
'table'
][
'column_comparison_info'
]
=
info
report
[
'table'
][
'column_comparison_needed'
]
=
column_comparison_needed
report
[
'table'
][
'column_comparison_info'
]
=
column_comparison_table
# Group body errors by row id
rows
=
[]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment