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

work

parent f22843d4
No related branches found
No related tags found
No related merge requests found
......@@ -22,10 +22,10 @@ class EcdcDateReported(ApplicationDateReported):
week_of_year = db.Column(db.Integer, nullable=False)
def get_name_for_datum(self):
return self.date_reported
return self.date_reported_import_str
def get_date_import_format_from_date_reported(self):
my_date_parts = self.date_reported.split("-")
my_date_parts = self.date_reported_import_str.split("-")
my_year = my_date_parts[0]
my_month = my_date_parts[1]
my_day = my_date_parts[2]
......@@ -59,12 +59,12 @@ class EcdcDateReported(ApplicationDateReported):
@classmethod
def create_new_object_factory(cls, my_date_rep: str):
(my_year, my_month, my_day) = cls.get_datum_parts(my_date_rep)
date_reported = super().get_datum_as_str(my_year, my_month, my_day)
date_reported_import_str = super().get_datum_as_str(my_year, my_month, my_day)
my_datum = super().get_datum(my_year, my_month, my_day)
(my_iso_year, week_number, weekday) = my_datum.isocalendar()
my_year_week = super().my_year_week(my_iso_year, week_number)
return EcdcDateReported(
date_reported_import_str=date_reported,
date_reported_import_str=date_reported_import_str,
datum=my_datum,
year=my_datum.year,
month=my_datum.month,
......@@ -195,15 +195,17 @@ class EcdcData(db.Model):
ecdc_country_id = db.Column(db.Integer, db.ForeignKey('ecdc_country.id'), nullable=False)
ecdc_country = db.relationship(
'EcdcCountry',
lazy='subquery', cascade="all, delete",
lazy='subquery',
cascade='save-update',
order_by='asc(EcdcCountry.countries_and_territories)'
)
ecdc_datereported_id = db.Column(db.Integer, db.ForeignKey('ecdc_datereported.id'), nullable=False)
ecdc_datereported = db.relationship(
'EcdcDateReported',
lazy='joined', cascade='all, delete',
order_by='desc(EcdcDateReported.date_reported)'
lazy='joined',
cascade='save-update',
order_by='desc(EcdcDateReported.date_reported_import_str)'
)
@classmethod
......
......@@ -64,7 +64,7 @@ class OwidCountry(db.Model):
continent = db.relationship(
'OwidContinent',
lazy='joined',
cascade='all, delete',
cascade='save-update',
order_by='desc(OwidContinent.region)')
iso_code = db.Column(db.String(255), nullable=False)
location = db.Column(db.String(255), nullable=False)
......@@ -137,14 +137,14 @@ class OwidData(db.Model):
date_reported = db.relationship(
'OwidDateReported',
lazy='joined',
cascade='all, delete',
order_by='desc(OwidDateReported.date_reported)')
cascade='save-update',
order_by='desc(OwidDateReported.date_reported_import_str)')
country_id = db.Column(db.Integer,
db.ForeignKey('owid_country.id'), nullable=False)
country = db.relationship(
'OwidCountry',
lazy='joined',
cascade='all, delete',
cascade='save-update',
order_by='desc(OwidCountry.location)')
total_cases = db.Column(db.String(255), nullable=False)
new_cases = db.Column(db.String(255), nullable=False)
......
......@@ -53,8 +53,8 @@ class RkiVaccinationData(db.Model):
date_reported = db.relationship(
'RkiVaccinationDateReported',
lazy='joined',
cascade='all, delete',
order_by='desc(RkiVaccinationDateReported.date_reported)')
cascade='save-update',
order_by='desc(RkiVaccinationDateReported.date_reported_import_str)')
dosen_kumulativ = db.Column(db.Integer, nullable=False)
dosen_differenz_zum_vortag = db.Column(db.Integer, nullable=False)
dosen_biontech_kumulativ = db.Column(db.Integer, nullable=False)
......
......@@ -190,7 +190,7 @@ class WhoData(db.Model):
'WhoDateReported',
lazy='joined',
cascade='save-update',
order_by='desc(WhoDateReported.date_reported)')
order_by='desc(WhoDateReported.date_reported_import_str)')
country_id = db.Column(db.Integer,
db.ForeignKey('who_country.id'), nullable=False)
country = db.relationship(
......
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