From 06d43b7549907e7cd69a83ee1f1a5c1ef1ed080e Mon Sep 17 00:00:00 2001
From: thomaswoehlke <thomas.woehlke@gmail.com>
Date: Sat, 29 May 2021 01:28:43 +0200
Subject: [PATCH] work

---
 .../data_vaccination/vaccination_service_update.py        | 4 +++-
 src/flask_covid19/blueprints/data_who/who_model.py        | 3 +--
 .../blueprints/data_who/who_service_update.py             | 8 +++++++-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/flask_covid19/blueprints/data_vaccination/vaccination_service_update.py b/src/flask_covid19/blueprints/data_vaccination/vaccination_service_update.py
index fcdd0e2c..e9de9e8b 100644
--- a/src/flask_covid19/blueprints/data_vaccination/vaccination_service_update.py
+++ b/src/flask_covid19/blueprints/data_vaccination/vaccination_service_update.py
@@ -1,4 +1,4 @@
-from database import db, app
+from database import db, app, cache
 from flask_covid19.blueprints.app_all.all_config import BlueprintConfig
 from flask_covid19.blueprints.app_web.web_model_factory import BlueprintDateReportedFactory
 from flask_covid19.blueprints.data_vaccination.vaccination_model_import import VaccinationImport
@@ -23,6 +23,8 @@ class VaccinationServiceUpdateFull(VaccinationServiceUpdateBase):
         app.logger.info(" VaccinationServiceUpdateFull.__full_update_date_reported [begin]")
         app.logger.info("------------------------------------------------------------")
         VaccinationDateReported.remove_all()
+        with app.app_context():
+            cache.clear()
         date_reported_list = VaccinationImport.get_date_reported_as_array()
         i = 0
         for one_date_reported in date_reported_list:
diff --git a/src/flask_covid19/blueprints/data_who/who_model.py b/src/flask_covid19/blueprints/data_who/who_model.py
index 02f82ec1..796482e1 100644
--- a/src/flask_covid19/blueprints/data_who/who_model.py
+++ b/src/flask_covid19/blueprints/data_who/who_model.py
@@ -67,8 +67,7 @@ class WhoCountry(BlueprintLocation):
     )
 
     def __repr__(self):
-        return "%s(%s %s %s)" % (self.__class__.__name__,
-                                 self.location_group.__repr__(), self.location_code, self.location)
+        return "%s(%s %s)" % (self.__class__.__name__, self.location_code, self.location)
 
     def __str__(self):
         return self.location_group.__str__() + " : " + self.location_code + " | " + self.location
diff --git a/src/flask_covid19/blueprints/data_who/who_service_update.py b/src/flask_covid19/blueprints/data_who/who_service_update.py
index 50e39556..4b1388bd 100644
--- a/src/flask_covid19/blueprints/data_who/who_service_update.py
+++ b/src/flask_covid19/blueprints/data_who/who_service_update.py
@@ -1,4 +1,4 @@
-from database import db, app
+from database import db, app, cache
 from flask_covid19.blueprints.app_all.all_config import BlueprintConfig
 from flask_covid19.blueprints.app_web.web_model_factory import BlueprintDateReportedFactory
 from flask_covid19.blueprints.data_who.who_model import WhoCountryRegion, WhoDateReported, WhoCountry, WhoData
@@ -22,6 +22,8 @@ class WhoServiceUpdateFull(WhoServiceUpdateBase):
         app.logger.info(" WhoServiceUpdateFull.__full_update_date_reported [begin]")
         app.logger.info("------------------------------------------------------------")
         WhoDateReported.remove_all()
+        with app.app_context():
+            cache.clear()
         log_lines = []
         i = 0
         # myresultarray = []
@@ -81,6 +83,8 @@ class WhoServiceUpdateFull(WhoServiceUpdateBase):
         app.logger.info("------------------------------------------------------------")
         WhoCountry.remove_all()
         self.__full_update_region()
+        with app.app_context():
+            cache.clear()
         result = WhoImport.countries()
         log_lines = []
         i = 0
@@ -114,6 +118,8 @@ class WhoServiceUpdateFull(WhoServiceUpdateBase):
         app.logger.info("------------------------------------------------------------")
         app.logger.info(" WhoData.remove_all() [begin]")
         WhoData.remove_all()
+        with app.app_context():
+            cache.clear()
         app.logger.info(" WhoData.remove_all() [done]")
         new_dates_reported_as_string_array = WhoImport.get_dates_reported_as_string_array()
         new_dates_reported_from_import = []
-- 
GitLab