Skip to content
Snippets Groups Projects
Commit 04a1bcdc authored by thomaswoehlke's avatar thomaswoehlke
Browse files

Refactoring: rename covid19 to flask_covid19ssaas

parent b2590c7a
No related branches found
No related tags found
1 merge request!162Refactoring 2021 05 20 start
...@@ -100,7 +100,7 @@ class RkiImport(db.Model): ...@@ -100,7 +100,7 @@ class RkiImport(db.Model):
@classmethod @classmethod
def find_by_datum(cls, my_datum: date): def find_by_datum(cls, my_datum: date):
db.session.query(cls) \ return db.session.query(cls) \
.filter(cls.datum == my_datum) \ .filter(cls.datum == my_datum) \
.order_by(cls.landkreis.asc()) \ .order_by(cls.landkreis.asc()) \
.all() .all()
......
...@@ -101,12 +101,23 @@ class RkiServiceUpdateFull(RkiServiceUpdateBase): ...@@ -101,12 +101,23 @@ class RkiServiceUpdateFull(RkiServiceUpdateBase):
RkiData.remove_all() RkiData.remove_all()
i = 0 i = 0
locations = RkiLandkreis.get_all_as_dict() locations = RkiLandkreis.get_all_as_dict()
for l_key in locations.keys(): # for l_key in locations.keys():
app.logger.info(" location: " + str(l_key) + " -> " + str(locations[l_key])) # app.logger.info(" location: " + str(l_key) + " -> " + str(locations[l_key]))
# app.logger.info("------------------------------------------------------------")
for d_meldedatum in RkiMeldedatum.get_all(): for d_meldedatum in RkiMeldedatum.get_all():
app.logger.info(" d_meldedatum: " + str(d_meldedatum) + " " + d_meldedatum.datum.isoformat()) d = d_meldedatum.datum
l_imports = RkiImport.find_by_datum(my_datum=d_meldedatum.datum) # app.logger.info(" d_meldedatum: " + str(d_meldedatum) + " " + d.isoformat())
# app.logger.info("------------------------------------------------------------")
l_imports = RkiImport.find_by_datum(my_datum=d)
# if l_imports is None:
# app.logger.info("l_imports is None ")
# else:
# nr = len(l_imports)
# app.logger.info("len(l_imports): " + str(nr))
# app.logger.info("------------------------------------------------------------")
for o_import in l_imports: for o_import in l_imports:
i += 1
# app.logger.info("o_import.landkreis " + o_import.landkreis)
o = RkiData( o = RkiData(
meldedatum=d_meldedatum, meldedatum=d_meldedatum,
landkreis=locations[o_import.landkreis], landkreis=locations[o_import.landkreis],
...@@ -128,7 +139,7 @@ class RkiServiceUpdateFull(RkiServiceUpdateBase): ...@@ -128,7 +139,7 @@ class RkiServiceUpdateFull(RkiServiceUpdateBase):
) )
db.session.add(o) db.session.add(o)
i += 1 i += 1
if i % 500 == 0: if i % 2000 == 0:
app.logger.info(" update WHO initial ... "+str(i)+" rows") app.logger.info(" update WHO initial ... "+str(i)+" rows")
db.session.commit() db.session.commit()
db.session.commit() db.session.commit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment