From b2848391fba935fe70427f7be9da5a3de2f51bd3 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 8 Nov 2022 15:48:46 +0000 Subject: [PATCH] additional_checks: Link to schema docs, count in header https://github.com/Open-Telecoms-Data/cove-ofds/issues/13 Also fix broken if clause - some errors would not have been shown Not sure how to do trans blocks correctly but it's not important for now so leaving for later --- .../cove_ofds/additional_checks_table.html | 126 ++++++++++++------ ...ditional_checks_table_failure_counter.html | 7 + 2 files changed, 95 insertions(+), 38 deletions(-) create mode 100644 cove_ofds/templates/cove_ofds/additional_checks_table_failure_counter.html diff --git a/cove_ofds/templates/cove_ofds/additional_checks_table.html b/cove_ofds/templates/cove_ofds/additional_checks_table.html index 94a502a..8152b9f 100644 --- a/cove_ofds/templates/cove_ofds/additional_checks_table.html +++ b/cove_ofds/templates/cove_ofds/additional_checks_table.html @@ -2,14 +2,16 @@ {% if 'span_start_node_not_found' in additional_checks or 'span_end_node_not_found' in additional_checks %} -

{% trans 'Node references' %}

-

{% trans 'Your data contains spans with node references that cannot be resolved. `Span.start` and `Span.end` must match the `.id` of exactly one node in the `/nodes` array.' %}

- {% if 'span_start_node_not_found' in additional_checks %} -

{% trans 'Schema Documentation' %}

- {% endif %} - {% if 'span_end_node_not_found' in additional_checks %} -

{% trans 'Schema Documentation' %}

- {% endif %} +

+ {% trans 'Node references' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.span_start_node_not_found list2=additional_checks.span_end_node_not_found %} +

+

+ {% trans 'Your data contains spans with node references that cannot be resolved. `Span.start` and `Span.end` must match the `.id` of exactly one node in the `/nodes` array.' %} + For more information, see + `Span.start` and + `Span.end`. +

@@ -51,9 +53,14 @@

{% trans 'Node references' %}

{% if 'node_location_type_incorrect' in additional_checks %} -

{% trans 'Node location type' %}

-

{% trans 'Your data contains nodes with incorrect location types. `/nodes/location/type` must be `Point`.' %}

-

{% trans 'Schema Documentation' %}

+

+ {% trans 'Node location type' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.node_location_type_incorrect %} +

+

+ {% trans 'Your data contains nodes with incorrect location types. `/nodes/location/type` must be `Point`.' %} + For more information, see `Geometry.type`. +

@@ -78,9 +85,14 @@

{% trans 'Node location type' %}

{% if 'node_location_coordinates_incorrect' in additional_checks %} -

{% trans 'Node location coordinates' %}

-

{% trans 'Your data contains nodes with incorrectly formatted location coordinates. `/nodes/location/coordinates` must be a single position, i.e. an array of numbers.' %}

-

{% trans 'Schema Documentation' %}

+

+ {% trans 'Node location coordinates' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.node_location_coordinates_incorrect %} +

+

+ {% trans 'Your data contains nodes with incorrectly formatted location coordinates. `/nodes/location/coordinates` must be a single position, i.e. an array of numbers.' %} + For more information, see `Geometry.coordinates`. +

@@ -105,9 +117,14 @@

{% trans 'Node location coordinates' %}

{% if 'span_route_type_incorrect' in additional_checks %} -

{% trans 'Span route geometry' %}

-

{% trans 'Your data contains spans with incorrect route types. `/spans/route/type` must be `LineString`.' %}

-

{% trans 'Schema Documentation' %}

+

+ {% trans 'Span route geometry' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.span_route_type_incorrect %} +

+

+ {% trans 'Your data contains spans with incorrect route types. `/spans/route/type` must be `LineString`.' %} + For more information, see `Geometry.type`. +

@@ -132,9 +149,14 @@

{% trans 'Span route geometry' %}

{% if 'span_route_coordinates_incorrect' in additional_checks %} -

{% trans 'Span route coordinates' %}

-

{% trans 'Your data contains spans with incorrectly formatted route coordinates. `/spans/route/coordinates` must be an array of positions, i.e. an array of arrays of numbers.' %}

-

{% trans 'Schema Documentation' %}

+

+ {% trans 'Span route coordinates' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.span_route_coordinates_incorrect %} +

+

+ {% trans 'Your data contains spans with incorrectly formatted route coordinates. `/spans/route/coordinates` must be an array of positions, i.e. an array of arrays of numbers.' %} + For more information, see `Geometry.coordinates`. +

@@ -159,9 +181,14 @@

{% trans 'Span route coordinates' %}

{% if 'node_phase_reference_id_not_found' in additional_checks or 'span_phase_reference_id_not_found' in additional_checks or 'contract_related_phase_reference_id_not_found' in additional_checks %} -

{% trans 'Phase references' %}

-

{% trans 'Your data contains phase references that cannot be resolved. The `.id` of each phase reference must match the `.id` of exactly one phase in the `/phases` array.' %}

-

{% trans 'Schema Documentation' %}

+

+ {% trans 'Phase references' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.node_phase_reference_id_not_found list2=additional_checks.span_phase_reference_id_not_found list3=additional_checks.contract_related_phase_reference_id_not_found %} +

+

+ {% trans 'Your data contains phase references that cannot be resolved. The `.id` of each phase reference must match the `.id` of exactly one phase in the `/phases` array.' %} + For more information, see `PhaseReference.id`. +

{% if 'node_phase_reference_id_not_found' in additional_checks %}
@@ -234,9 +261,14 @@

{% trans 'Phase references' %}

{% if 'node_phase_reference_name_does_not_match' in additional_checks or 'span_phase_reference_name_does_not_match' in additional_checks or 'contract_related_phase_reference_name_does_not_match' in additional_checks %} -

{% trans 'Phase names' %}

-

{% trans 'Your data contains phase references with inconsistent names. The `.name` of each phase reference must match the `.name` of the phase it references.' %}

-

{% trans 'Schema Documentation' %}

+

+ {% trans 'Phase names' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.node_phase_reference_name_does_not_match list2=additional_checks.span_phase_reference_name_does_not_match list3=additional_checks.contract_related_phase_reference_name_does_not_match %} +

+

+ {% trans 'Your data contains phase references with inconsistent names. The `.name` of each phase reference must match the `.name` of the phase it references.' %} + For more information, see `PhaseReference.name`. +

{% if 'node_phase_reference_name_does_not_match' in additional_checks %}
@@ -306,10 +338,15 @@

{% trans 'Phase names' %}

{% 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 %} -

{% trans 'Organisation references' %}

-

{% trans 'Your data contains organisation references that cannot be resolved. The `.id` of each organisation reference must match the `.id` of exactly one organisation in the `/organisations` array.' %}

-

{% trans 'Schema Documentation' %}

+{% if 'node_organisation_reference_id_not_found' in additional_checks or 'span_organisation_reference_id_not_found' in additional_checks or 'phase_organisation_reference_id_not_found' in additional_checks %} +

+ {% trans 'Organisation references' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.node_organisation_reference_id_not_found list2=additional_checks.span_organisation_reference_id_not_found list3=additional_checks.phase_organisation_reference_id_not_found %} +

+

+ {% trans 'Your data contains organisation references that cannot be resolved. The `.id` of each organisation reference must match the `.id` of exactly one organisation in the `/organisations` array.' %} + For more information, see `OrganisationReference.id`. +

{% if 'node_organisation_reference_id_not_found' in additional_checks %}
@@ -388,10 +425,15 @@

{% trans 'Organisation references' %}

-{% if 'node_organisation_reference_name_does_not_match' in additional_checks %} -

{% trans 'Organisation names' %}

-

{% trans 'Your data contains organisation references with inconsistent names. The `.name` of each organisation reference must match the `.name` of the organisation it references.' %}

-

{% trans 'Schema Documentation' %}

+{% if 'node_organisation_reference_name_does_not_match' in additional_checks or 'span_organisation_reference_name_does_not_match' in additional_checks or 'phase_organisation_reference_name_does_not_match' in additional_checks %} +

+ {% trans 'Organisation names' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.node_organisation_reference_name_does_not_match list2=additional_checks.span_organisation_reference_name_does_not_match list3=additional_checks.phase_organisation_reference_name_does_not_match %} +

+

+ {% trans 'Your data contains organisation references with inconsistent names. The `.name` of each organisation reference must match the `.name` of the organisation it references.' %} + For more information, see `OrganisationReference.name`. +

{% if 'node_organisation_reference_name_does_not_match' in additional_checks %}
@@ -470,9 +512,14 @@

{% trans 'Organisation names' %}

{% if 'node_international_connections_country_not_set' in additional_checks %} -

{% trans 'International connection countries' %}

-

{% 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`.' %}

-

{% trans 'Schema Documentation' %}

+

+ {% trans 'International connection countries' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.node_international_connections_country_not_set %} +

+

+ {% 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`.' %} + For more information, see `Node.internationalConnections`. +

@@ -497,7 +544,10 @@

{% trans 'International connection countries' %}

{% if 'node_not_used_in_any_spans' in additional_checks %} -

{% trans 'Unreferenced nodes' %}

+

+ {% trans 'Unreferenced nodes' %} + {% include 'cove_ofds/additional_checks_table_failure_counter.html' with list1=additional_checks.node_not_used_in_any_spans %} +

{% trans 'Your data contains nodes that are not referenced by any spans.' %}

diff --git a/cove_ofds/templates/cove_ofds/additional_checks_table_failure_counter.html b/cove_ofds/templates/cove_ofds/additional_checks_table_failure_counter.html new file mode 100644 index 0000000..22644cc --- /dev/null +++ b/cove_ofds/templates/cove_ofds/additional_checks_table_failure_counter.html @@ -0,0 +1,7 @@ +{% load i18n %} + +{% with l1l=list1|length l2l=list2|length l3l=list3|length%} + {% with count=l1l|add:l2l|add:l3l %} + ({% if count == 1 %}1 failure{% else %}{{ count }} {% trans 'failures' %}{% endif %}) + {% endwith %} +{% endwith %}