From 4c9ba754cf3a2227fed85721455d3405b197d563 Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Thu, 27 May 2021 21:24:37 +0200 Subject: [PATCH] Refactoring: vaccination --- src/flask_covid19/blueprints/data_ecdc/ecdc_model.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py b/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py index b9084c51..d7e4e5fd 100644 --- a/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py +++ b/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py @@ -150,14 +150,12 @@ class EcdcData(BlueprintFactTable): @classmethod def __query_by_date_reported(cls, date_reported: EcdcDateReported): - return db.session.query(cls).filter( - cls.date_reported_id == date_reported.id) \ + return db.session.query(cls).filter(cls.date_reported_id == date_reported.id) \ .order_by(cls.cumulative_number_for_14_days_of_covid19_cases_per_100000.desc()) @classmethod def __query_by_date_reported_order_by_notification_rate(cls, date_reported: EcdcDateReported): - return db.session.query(cls).filter( - cls.date_reported_id == date_reported.id) \ + return db.session.query(cls).filter(cls.date_reported_id == date_reported.id) \ .order_by(cls.cumulative_number_for_14_days_of_covid19_cases_per_100000.desc()) @classmethod @@ -168,19 +166,19 @@ class EcdcData(BlueprintFactTable): @classmethod def __query_by_date_reported_order_by_cases(cls, date_reported: EcdcDateReported): return db.session.query(cls)\ - .filter(cls.date_reported == date_reported) \ + .filter(cls.date_reported_id == date_reported.id) \ .order_by(cls.cases.desc()) @classmethod def __query_by_location(cls, location: EcdcCountry): return db.session.query(cls)\ - .filter(cls.location == location) \ + .filter(cls.location_id == location.id) \ .order_by(cls.date_reported.desc()) @classmethod def __query_by_date_reported_and_location(cls, date_reported: EcdcDateReported, location: EcdcCountry): return db.session.query(cls) \ - .filter(and_((cls.location == location), (cls.date_reported == date_reported))) + .filter(and_((cls.location_id == location.id), (cls.date_reported_id == date_reported.id))) @classmethod def find_by_date_reported(cls, date_reported: EcdcDateReported): -- GitLab