From 6231d96f2947b63d0e21eb8d172789a39e057979 Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Thu, 27 May 2021 01:57:17 +0200 Subject: [PATCH] Refactoring: vaccination --- src/flask_covid19/blueprints/data_ecdc/ecdc_model.py | 4 ++-- src/flask_covid19/blueprints/data_ecdc/ecdc_views.py | 2 +- .../ecdc/continent/all/ecdc_continent_all_table.html | 6 +++--- .../templates/ecdc/country/all/ecdc_country_all_table.html | 2 +- .../data_ecdc/templates/ecdc/ecdc_data/ecdc_data_table.html | 5 ++++- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py b/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py index 3099cf3f..69a993e7 100644 --- a/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py +++ b/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py @@ -102,7 +102,7 @@ class EcdcCountry(BlueprintLocation): @classmethod def find_by_location_group(cls, location_group: EcdcContinent, page: int): return db.session.query(cls)\ - .filter(cls.location_group_id == location_group.id)\ + .filter(cls.location_group == location_group)\ .paginate(page, per_page=ITEMS_PER_PAGE) @classmethod @@ -122,7 +122,7 @@ class EcdcData(BlueprintFactTable): 'EcdcDateReported', lazy='joined', cascade='save-update', - order_by='desc(OwidDateReported.datum)') + order_by='desc(EcdcDateReported.datum)') location_id = db.Column(db.Integer, db.ForeignKey('ecdc_country.id'), nullable=False) location = db.relationship( 'EcdcCountry', diff --git a/src/flask_covid19/blueprints/data_ecdc/ecdc_views.py b/src/flask_covid19/blueprints/data_ecdc/ecdc_views.py index 04c24919..bf0a24ec 100644 --- a/src/flask_covid19/blueprints/data_ecdc/ecdc_views.py +++ b/src/flask_covid19/blueprints/data_ecdc/ecdc_views.py @@ -121,7 +121,7 @@ def url_ecdc_continent_all(page=1): @app_ecdc.route('/continent/<int:continent_id>/page/<int:page>') @app_ecdc.route('/continent/<int:continent_id>') -def url_ecdc_continent_one(continent_id, page=1): +def url_ecdc_continent_one(continent_id: int, page=1): page_info = WebPageContent('Europe', "continent") continent = EcdcContinent.get_by_id(continent_id) page_data = EcdcCountry.find_by_location_group(continent, page) diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/continent/all/ecdc_continent_all_table.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/continent/all/ecdc_continent_all_table.html index 7deeec25..b7df855d 100644 --- a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/continent/all/ecdc_continent_all_table.html +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/continent/all/ecdc_continent_all_table.html @@ -5,11 +5,11 @@ </tr> </thead> <tbody> - {% for europe_continent in page_data.items %} + {% for ecdc_continent in page_data.items %} <tr> <td> - <a href="{{ url_for( 'ecdc.url_ecdc_continent_one', continent_id=europe_continent.id) }}"> - {{ europe_continent.location_group }} + <a href="{{ url_for( 'ecdc.url_ecdc_continent_one', continent_id=ecdc_continent.id) }}"> + {{ ecdc_continent.location_group }} </a> </td> </tr> diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/country/all/ecdc_country_all_table.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/country/all/ecdc_country_all_table.html index 8a190726..beded7b4 100644 --- a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/country/all/ecdc_country_all_table.html +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/country/all/ecdc_country_all_table.html @@ -29,7 +29,7 @@ </a> </td> <td> - <a href="{{ url_for('ecdc.url_ecdc_continent_one', country_id=europe_country.location_group.id) }}"> + <a href="{{ url_for('ecdc.url_ecdc_continent_one', continent_id=europe_country.location_group.id) }}"> {{ europe_country.location_group.location_group }} </a> </td> diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/ecdc_data/ecdc_data_table.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/ecdc_data/ecdc_data_table.html index 10a134b5..3eb38ce5 100644 --- a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/ecdc_data/ecdc_data_table.html +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/ecdc_data/ecdc_data_table.html @@ -44,7 +44,7 @@ {% endif %} </th> <th scope="col"> - <a href="/ecdc/country/all"> + <a href="{{ url_for( 'ecdc.url_ecdc_country_all') }}"> countries and territories </a> </th> @@ -70,6 +70,9 @@ {% for ecdc_data in page_data.items %} <tr> <td> + <a href="{{ url_for( 'ecdc.url_ecdc_date_reported_one_notification_rate', + europe_date_reported_id=europe_date_reported.id, + page=page_data.page) }}"> <a href="/ecdc/date_reported/{{ ecdc_data.ecdc_datereported.id }}"> {{ ecdc_data.ecdc_datereported.get_name_for_datum() }} </a> -- GitLab