From 4959a7930955a6940a8f89adae5062c17ebf3056 Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Thu, 27 May 2021 23:12:46 +0200 Subject: [PATCH] Refactoring: vaccination --- .../blueprints/data_owid/owid_views.py | 10 ++--- .../all/owid_continent_all_table.html | 4 +- .../country/one/who_country_one_table.html | 45 +------------------ .../one/who_country_one_table_head.html | 2 +- .../who/data/who_table_global_data.html | 2 +- .../one/who_date_reported_one_table.html | 2 +- .../templates/who/flat/who_flat_table.html | 4 +- .../who/imported/who_imported_table.html | 4 +- .../who/region/all/who_region_all_table.html | 4 +- 9 files changed, 18 insertions(+), 59 deletions(-) diff --git a/src/flask_covid19/blueprints/data_owid/owid_views.py b/src/flask_covid19/blueprints/data_owid/owid_views.py index 3a10e796..8e93d611 100644 --- a/src/flask_covid19/blueprints/data_owid/owid_views.py +++ b/src/flask_covid19/blueprints/data_owid/owid_views.py @@ -99,7 +99,7 @@ def url_owid_date_reported_one(date_reported_id: int, page: int = 1): "data of all reported countries for OWID date reported " + str(date_reported) + " " ) try: - page_data = OwidData.get_data_for_day(date_reported, page) + page_data = OwidData.get_by_date_reported(date_reported, page) except OperationalError: flash("No data in the database.") page_data = None @@ -120,7 +120,7 @@ def url_owid_date_reported_one_cases_new(date_reported_id: int, page: int = 1): "data of all reported countries for OWID date reported " + str(date_reported) + " " ) try: - page_data = OwidData.get_data_for_day_order_by_cases_new(date_reported, page) + page_data = OwidData.find_by_date_reported_order_by_cases_new(date_reported, page) except OperationalError: flash("No data in the database.") page_data = None @@ -141,7 +141,7 @@ def url_owid_date_reported_one_cases_cumulative(date_reported_id: int, page: int "data of all reported countries for OWID date reported " + str(date_reported) + " " ) try: - page_data = OwidData.get_data_for_day_order_by_cases_cumulative(date_reported, page) + page_data = OwidData.find_by_date_reported_order_by_cases_cumulative(date_reported, page) except OperationalError: flash("No data in the database.") page_data = None @@ -162,7 +162,7 @@ def url_owid_date_reported_one_deaths_new(date_reported_id: int, page: int = 1): "data of all reported countries for OWID date reported " + str(date_reported) + " " ) try: - page_data = OwidData.get_data_for_day_order_by_deaths_new(date_reported, page) + page_data = OwidData.find_by_date_reported_order_by_deaths_new(date_reported, page) except OperationalError: flash("No data in the database.") page_data = None @@ -183,7 +183,7 @@ def url_owid_date_reported_one_deaths_cumulative(date_reported_id: int, page: in "data of all reported countries for OWID date reported " + str(date_reported) + " " ) try: - page_data = OwidData.get_data_for_day_order_by_deaths_cumulative(date_reported, page) + page_data = OwidData.find_by_date_reported_order_by_deaths_cumulative(date_reported, page) except OperationalError: flash("No data in the database.") page_data = None diff --git a/src/flask_covid19/blueprints/data_owid/templates/owid/continent/all/owid_continent_all_table.html b/src/flask_covid19/blueprints/data_owid/templates/owid/continent/all/owid_continent_all_table.html index 3b3aaeef..79b3cafe 100644 --- a/src/flask_covid19/blueprints/data_owid/templates/owid/continent/all/owid_continent_all_table.html +++ b/src/flask_covid19/blueprints/data_owid/templates/owid/continent/all/owid_continent_all_table.html @@ -1,6 +1,6 @@ <div class="table-responsive"> <table class="table table-hover table-striped table-dark"> - <thead> + <thead class="table-secondary"> <tr> <th scope="col">continent</th> </tr> @@ -16,7 +16,7 @@ </tr> {% endfor %} </tbody> - <tfoot> + <tfoot class="table-secondary"> <tr> <th scope="col">continent</th> </tr> diff --git a/src/flask_covid19/blueprints/data_who/templates/who/country/one/who_country_one_table.html b/src/flask_covid19/blueprints/data_who/templates/who/country/one/who_country_one_table.html index 8f560753..33ac0705 100644 --- a/src/flask_covid19/blueprints/data_who/templates/who/country/one/who_country_one_table.html +++ b/src/flask_covid19/blueprints/data_who/templates/who/country/one/who_country_one_table.html @@ -1,48 +1,7 @@ <div class="table-responsive"> <table class="table table-hover table-striped table-dark"> <thead class="table-secondary"> - <tr> - <th scope="col"> - <a href="{{ url_for('who.url_who_date_reported_all') }}"> - date reported - </a> - </th> - <th scope="col"> - <a href="{{ url_for('who.url_who_country_deaths_new',country_id=who_country.id) }}"> - deaths new - </a> - </th> - <th scope="col"> - <a href="{{ url_for('who.url_who_country_cases_new',country_id=who_country.id) }}"> - cases new - </a> - </th> - <th scope="col"> - <a href="{{ url_for('who.url_who_country_deaths_cumulative',country_id=who_country.id) }}"> - deaths cumulative - </a> - </th> - <th scope="col"> - <a href="{{ url_for('who.url_who_country_cases_cumulative',country_id=who_country.id) }}"> - cases cumulative - </a> - </th> - <th scope="col"> - <a href="{{ url_for('who.url_who_country_all') }}"> - country code - </a> - </th> - <th scope="col"> - <a href="{{ url_for('who.url_who_country_all') }}"> - country - </a> - </th> - <th scope="col"> - <a href="{{ url_for('who.url_who_region_all') }}"> - region - </a> - </th> - </tr> + {% include 'who/country/one/who_country_one_table_head.html' %} </thead> <tbody> {% for who_global_data in page_data.items %} @@ -83,7 +42,7 @@ {% endfor %} </tbody> <tfoot> - + {% include 'who/country/one/who_country_one_table_head.html' %} </tfoot> </table> </div> \ No newline at end of file diff --git a/src/flask_covid19/blueprints/data_who/templates/who/country/one/who_country_one_table_head.html b/src/flask_covid19/blueprints/data_who/templates/who/country/one/who_country_one_table_head.html index 1608036a..a370849d 100644 --- a/src/flask_covid19/blueprints/data_who/templates/who/country/one/who_country_one_table_head.html +++ b/src/flask_covid19/blueprints/data_who/templates/who/country/one/who_country_one_table_head.html @@ -1,4 +1,4 @@ - <tr> +<tr> <th scope="col"> <a href="{{ url_for('who.url_who_date_reported_all') }}"> date reported diff --git a/src/flask_covid19/blueprints/data_who/templates/who/data/who_table_global_data.html b/src/flask_covid19/blueprints/data_who/templates/who/data/who_table_global_data.html index 2a1df620..a18e192a 100644 --- a/src/flask_covid19/blueprints/data_who/templates/who/data/who_table_global_data.html +++ b/src/flask_covid19/blueprints/data_who/templates/who/data/who_table_global_data.html @@ -33,7 +33,7 @@ </tr> {% endfor %} </tbody> - <tfoot> + <tfoot class="table-secondary"> {% include 'who/data/who_table_global_data_head.html' %} </tfoot> </table> diff --git a/src/flask_covid19/blueprints/data_who/templates/who/date_reported/one/who_date_reported_one_table.html b/src/flask_covid19/blueprints/data_who/templates/who/date_reported/one/who_date_reported_one_table.html index c44fb605..491bf8d8 100644 --- a/src/flask_covid19/blueprints/data_who/templates/who/date_reported/one/who_date_reported_one_table.html +++ b/src/flask_covid19/blueprints/data_who/templates/who/date_reported/one/who_date_reported_one_table.html @@ -41,7 +41,7 @@ </tr> {% endfor %} </tbody> - <tfoot> + <tfoot class="table-secondary"> {% include 'who/date_reported/one/who_date_reported_one_table_head.html' %} </tfoot> </table> diff --git a/src/flask_covid19/blueprints/data_who/templates/who/flat/who_flat_table.html b/src/flask_covid19/blueprints/data_who/templates/who/flat/who_flat_table.html index c28f75d8..e79b2c5d 100644 --- a/src/flask_covid19/blueprints/data_who/templates/who/flat/who_flat_table.html +++ b/src/flask_covid19/blueprints/data_who/templates/who/flat/who_flat_table.html @@ -1,6 +1,6 @@ <div class="table-responsive"> <table class="table table-hover table-striped table-dark"> - <thead> + <thead class="table-secondary"> {% include 'who/flat/who_flat_table_head.html' %} </thead> <tbody> @@ -33,7 +33,7 @@ </tr> {% endfor %} </tbody> - <tfoot> + <tfoot class="table-secondary"> {% include 'who/flat/who_flat_table_head.html' %} </tfoot> </table> diff --git a/src/flask_covid19/blueprints/data_who/templates/who/imported/who_imported_table.html b/src/flask_covid19/blueprints/data_who/templates/who/imported/who_imported_table.html index 6e1b392d..a5371d7d 100644 --- a/src/flask_covid19/blueprints/data_who/templates/who/imported/who_imported_table.html +++ b/src/flask_covid19/blueprints/data_who/templates/who/imported/who_imported_table.html @@ -1,6 +1,6 @@ <div class="table-responsive"> <table class="table table-hover table-striped table-dark"> - <thead> + <thead class="table-secondary"> {% include 'who/imported/who_imported_table_head.html' %} </thead> <tbody> @@ -17,7 +17,7 @@ </tr> {% endfor %} </tbody> - <tfoot> + <tfoot class="table-secondary"> {% include 'who/imported/who_imported_table_head.html' %} </tfoot> </table> diff --git a/src/flask_covid19/blueprints/data_who/templates/who/region/all/who_region_all_table.html b/src/flask_covid19/blueprints/data_who/templates/who/region/all/who_region_all_table.html index 4548c266..bbedbc46 100644 --- a/src/flask_covid19/blueprints/data_who/templates/who/region/all/who_region_all_table.html +++ b/src/flask_covid19/blueprints/data_who/templates/who/region/all/who_region_all_table.html @@ -1,6 +1,6 @@ <div class="table-responsive"> <table class="table table-hover table-striped table-dark"> - <thead> + <thead class="table-secondary"> <tr> <th scope="col">who_region</th> </tr> @@ -16,7 +16,7 @@ </tr> {% endfor %} </tbody> - <tfoot> + <tfoot class="table-secondary"> <tr> <th scope="col">who_region</th> </tr> -- GitLab