From 6dbf2303d14fef06065d796237307cffc1a68ab2 Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:00:14 -0500 Subject: [PATCH] improve look of page --- hakai_ckan_records_checks/__main__.py | 2 +- hakai_ckan_records_checks/hakai.py | 2 +- hakai_ckan_records_checks/templates/index.html.jinja | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hakai_ckan_records_checks/__main__.py b/hakai_ckan_records_checks/__main__.py index ee20c1e9..759df71a 100644 --- a/hakai_ckan_records_checks/__main__.py +++ b/hakai_ckan_records_checks/__main__.py @@ -132,7 +132,7 @@ def main(ckan_url, api_key, output, max_workers, log_level, cache): standardized_issues['message'] = standardized_issues['message'].str.replace('resources\[[0-9]+\]','resources[...]',regex=True) # Generate figures - pie_chart = px.pie(standardized_issues, names='message',title='Hakai Records Issues Distribution') + pie_chart = px.pie(standardized_issues, names='message',title=f'Hakai Records Issues Distribution: {len(standardized_issues)} issues detected') pie_chart.update_traces(textposition='inside') pie_chart.update_layout(uniformtext_minsize=12, uniformtext_mode='hide') pie_chart_html = pie_chart.to_html(full_html=False) diff --git a/hakai_ckan_records_checks/hakai.py b/hakai_ckan_records_checks/hakai.py index e3465300..4fe962e6 100644 --- a/hakai_ckan_records_checks/hakai.py +++ b/hakai_ckan_records_checks/hakai.py @@ -66,7 +66,7 @@ def _test(condition, level, message): f"Invalid resource format: resources[{index}].format={resource['format']}", ) _test( - requests.get(resource["url"]).status_code == 200, + int(requests.get(resource["url"]).status_code) in (200, 201), "ERROR", f"Invalid resources[{index}].url.status_code={requests.get(resource['url']).status_code}", ) diff --git a/hakai_ckan_records_checks/templates/index.html.jinja b/hakai_ckan_records_checks/templates/index.html.jinja index d55510fa..3087b272 100644 --- a/hakai_ckan_records_checks/templates/index.html.jinja +++ b/hakai_ckan_records_checks/templates/index.html.jinja @@ -69,10 +69,11 @@ h3 {

Report Summary
{{ckan_url}}

-

This page present a summary of: -
Records hosted on the catalogue -
Issues detected in some records -

+

This page present a summary of:

+
{{ issues_pie_chart }}