Skip to content

Commit

Permalink
additional_checks: Show name not matching errors together
Browse files Browse the repository at this point in the history
Show *_reference_name_set_but_not_in_original in the same block as
*_name_does_not_match errors

#13 (comment)
  • Loading branch information
jarofgreen committed Nov 4, 2022
1 parent ad9b3b5 commit a28ec7d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 167 deletions.
35 changes: 35 additions & 0 deletions cove_ofds/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,41 @@ def process(self, process_data: dict) -> dict:
context["additional_checks"], lambda i: i["type"]
)

# The library returns *_name_does_not_match and *_reference_name_set_but_not_in_original as different types,
# but in this UI we don't care - we just want to show them as one section.
# So join the 2 types of errors into 1 list.
for f1, f2 in [
(
"node_phase_reference_name_does_not_match",
"node_phase_reference_name_set_but_not_in_original",
),
(
"span_phase_reference_name_does_not_match",
"span_phase_reference_name_set_but_not_in_original",
),
(
"contract_related_phase_reference_name_does_not_match",
"contract_related_phase_reference_name_set_but_not_in_original",
),
(
"node_organisation_reference_name_does_not_match",
"node_organisation_reference_name_set_but_not_in_original",
),
(
"span_organisation_reference_name_does_not_match",
"span_organisation_reference_name_set_but_not_in_original",
),
(
"phase_organisation_reference_name_does_not_match",
"phase_organisation_reference_name_set_but_not_in_original",
),
]:
new_list = context["additional_checks"].get(f1, []) + context[
"additional_checks"
].get(f2, [])
if new_list:
context["additional_checks"][f1] = new_list

with open(self.data_filename, "w") as fp:
json.dump(context, fp, indent=4)

Expand Down
167 changes: 0 additions & 167 deletions cove_ofds/templates/cove_ofds/additional_checks_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,85 +293,6 @@ <h3>{% trans 'Phase names' %}</h3>
{% endif %}
{% endif %}

{% if 'node_phase_reference_name_set_but_not_in_original' in additional_checks %}
<h3>{% trans 'TODO node_phase_reference_name_set_but_not_in_original' %}</h3>
<p>{% trans 'TODO' %}</p>
<table class="table">
<thead>
<tr>
<th class="">{% trans 'Node Id' %}</th>
<th class="">{% trans 'Network ID' %}</th>
</tr>
</thead>
<tbody>
{% for additional_check in additional_checks.node_phase_reference_name_set_but_not_in_original %}
<tr>
<td>
{{ additional_check.node_id }}
</td>
<td>
{{ additional_check.network_id }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}




{% if 'span_phase_reference_name_set_but_not_in_original' in additional_checks %}
<h3>{% trans 'TODO span_phase_reference_name_set_but_not_in_original' %}</h3>
<p>{% trans 'TODO' %}</p>
<table class="table">
<thead>
<tr>
<th class="">{% trans 'Span Id' %}</th>
<th class="">{% trans 'Network ID' %}</th>
</tr>
</thead>
<tbody>
{% for additional_check in additional_checks.span_phase_reference_name_set_but_not_in_original %}
<tr>
<td>
{{ additional_check.span_id }}
</td>
<td>
{{ additional_check.network_id }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}


{% if 'contract_related_phase_reference_name_set_but_not_in_original' in additional_checks %}
<h3>{% trans 'TODO span_phase_reference_name_set_but_not_in_original' %}</h3>
<p>{% trans 'TODO' %}</p>
<table class="table">
<thead>
<tr>
<th class="">{% trans 'Contract Id' %}</th>
<th class="">{% trans 'Network ID' %}</th>
</tr>
</thead>
<tbody>
{% for additional_check in additional_checks.contract_related_phase_reference_name_set_but_not_in_original %}
<tr>
<td>
{{ additional_check.contract_id }}
</td>
<td>
{{ additional_check.network_id }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}


{% if 'node_organisation_reference_id_not_found' in additional_checks or 'node_organisation_reference_id_not_found' in additional_checks or 'phase_organisation_reference_id_not_found' in additional_checks %}
<h3>{% trans 'Organisation references' %}</h3>
Expand Down Expand Up @@ -534,94 +455,6 @@ <h3>{% trans 'Organisation names' %}</h3>
{% endif %}


{% if 'node_organisation_reference_name_set_but_not_in_original' in additional_checks %}
<h3>{% trans 'TODO node_organisation_reference_name_set_but_not_in_original' %}</h3>
<p>{% trans 'TODO ' %}</p>
<table class="table">
<thead>
<tr>
<th class="">{% trans 'Field' %}</th>
<th class="">{% trans 'Node Id' %}</th>
<th class="">{% trans 'Network ID' %}</th>
</tr>
</thead>
<tbody>
{% for additional_check in additional_checks.node_organisation_reference_name_set_but_not_in_original %}
<tr>
<td>
{{ additional_check.field }}
</td>
<td>
{{ additional_check.node_id }}
</td>
<td>
{{ additional_check.network_id }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}


{% if 'span_organisation_reference_name_set_but_not_in_original' in additional_checks %}
<h3>{% trans 'TODO span_organisation_reference_name_set_but_not_in_original' %}</h3>
<p>{% trans 'TODO ' %}</p>
<table class="table">
<thead>
<tr>
<th class="">{% trans 'Field' %}</th>
<th class="">{% trans 'Span Id' %}</th>
<th class="">{% trans 'Network ID' %}</th>
</tr>
</thead>
<tbody>
{% for additional_check in additional_checks.span_organisation_reference_name_set_but_not_in_original %}
<tr>
<td>
{{ additional_check.field }}
</td>
<td>
{{ additional_check.span_id }}
</td>
<td>
{{ additional_check.network_id }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}




{% if 'phase_organisation_reference_name_set_but_not_in_original' in additional_checks %}
<h3>{% trans 'TODO phase_organisation_reference_name_set_but_not_in_original' %}</h3>
<p>{% trans 'TODO ' %}</p>
<table class="table">
<thead>
<tr>
<th class="">{% trans 'Phase Id' %}</th>
<th class="">{% trans 'Network ID' %}</th>
</tr>
</thead>
<tbody>
{% for additional_check in additional_checks.phase_organisation_reference_name_set_but_not_in_original %}
<tr>
<td>
{{ additional_check.phase_id }}
</td>
<td>
{{ additional_check.network_id }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}


{% if 'node_international_connections_country_not_set' in additional_checks %}
<h3>{% trans 'International connection countries' %}</h3>
<p>{% trans 'Your data contains nodes with international connections that do not specify a country. `.country` must be set for each international connection in `/nodes/internationalConnections`.' %}</p>
Expand Down

0 comments on commit a28ec7d

Please sign in to comment.