diff --git a/src/covid19/blueprints/who/who_model.py b/src/covid19/blueprints/who/who_model.py index 80e4c94ead57818d18bfb419d811b706716687c3..0a8e3c64bd18c709b0a1d0555ba1dd4eda8b3fb1 100644 --- a/src/covid19/blueprints/who/who_model.py +++ b/src/covid19/blueprints/who/who_model.py @@ -252,7 +252,7 @@ class WhoData(db.Model): def delete_data_for_one_day(cls, date_reported): for one_who_date in cls.get_data_for_one_day(date_reported): db.session.delete(one_who_date) - db.session.commit() + db.session.commit() return None @classmethod @@ -352,3 +352,7 @@ class WhoData(db.Model): datum_of_all_who_data.append(datum) datum_of_all_who_data.sort() return datum_of_all_who_data + + @classmethod + def get_joungest_datum(cls): + return cls.get_datum_of_all_who_data().pop() diff --git a/src/covid19/blueprints/who/who_service_update.py b/src/covid19/blueprints/who/who_service_update.py index 0229b3457e6e222a8e6e4d3bfb9b10173e3d5624..a984b67bd6ea0c6a58b9b6a6a2b2c9a375fd4ff1 100644 --- a/src/covid19/blueprints/who/who_service_update.py +++ b/src/covid19/blueprints/who/who_service_update.py @@ -103,6 +103,7 @@ class WhoServiceUpdate: new_dates_reported_from_import = self.who_import_get_new_dates_as_array() i = 0 for my_date_reported in new_dates_reported_from_import: + app.logger.info(my_date_reported) my_date = WhoDateReported.find_by_date_reported(my_date_reported) if my_date is None: myday = WhoDateReported.create_new_object_factory(my_date_reported) diff --git a/src/covid19/blueprints/who_test/who_test_service.py b/src/covid19/blueprints/who_test/who_test_service.py index 3fdf6274a0a5fe2e2b2ec77bbeadd15ac2d423c0..ab8f987ab1317ececcee9bea766bec621db365fa 100644 --- a/src/covid19/blueprints/who_test/who_test_service.py +++ b/src/covid19/blueprints/who_test/who_test_service.py @@ -15,7 +15,8 @@ class WhoTestService: app.logger.info(" WHO Test Service [ready]") def delete_last_day(self): - joungest_datum = WhoDateReported.get_joungest_datum() + joungest_datum_str = WhoData.get_joungest_datum() + joungest_datum = WhoDateReported.find_by_date_reported(joungest_datum_str) app.logger.info("joungest_datum:") app.logger.info(joungest_datum) app.logger.info("WhoData.get_data_for_one_day(joungest_datum):")