diff --git a/covid19/blueprints/europe/europe_model.py b/covid19/blueprints/europe/europe_model.py index 89e8bd339fa2333bf54a32547a61e02e0c6ac47a..c7c61fdd97195dfa5c07b2fd6a9e331f0230f8cc 100644 --- a/covid19/blueprints/europe/europe_model.py +++ b/covid19/blueprints/europe/europe_model.py @@ -16,7 +16,7 @@ class EuropeDateReported(db.Model): day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) - def get_name_for_datum(self): + def __str__(self): result = "" if self.day_of_month < 10: result += "0" + str(self.day_of_month) @@ -37,6 +37,19 @@ class EuropeDateReported(db.Model): return {1: "Montag", 2: "Dienstag", 3: "Mittwoch", 4: "Donnerstag", 5: "Freitag", 6: "Samstag", 7: "Sonntag"} + def get_name_for_datum(self): + result = "" + if self.day_of_month < 10: + result += "0" + str(self.day_of_month) + else: + result += "" + str(self.day_of_month) + if self.month < 10: + result += ".0" + str(self.month) + else: + result += "." + str(self.month) + result += "." + str(self.year) + return result + @classmethod def create_new_object_factory(cls, my_date_rep, my_year_week): my_date_reported = my_date_rep.split('/') diff --git a/covid19/blueprints/europe/templates/europe/fragments/fragment_europe_table_date_reported.html b/covid19/blueprints/europe/templates/europe/fragments/fragment_europe_table_date_reported.html index f842320f0e3f360376744a1e43fa50ed90266be6..365eeb383032d0fc4b5fe96e6c33719c2e47cf30 100644 --- a/covid19/blueprints/europe/templates/europe/fragments/fragment_europe_table_date_reported.html +++ b/covid19/blueprints/europe/templates/europe/fragments/fragment_europe_table_date_reported.html @@ -1,3 +1,4 @@ + <!-- <table class="table table-hover table-striped table-dark"> <thead class="table-secondary"> <tr> @@ -21,4 +22,44 @@ </tr> {% endfor %} </tbody> + </table> + --> + + <table class="table table-hover table-striped table-dark"> + <thead class="table-secondary"> + <tr> + <th scope="col" class="text-right">day of week</th> + <th scope="col" class="text-left">date reported</th> + <th scope="col" class="text-right">week of year</th> + <th scope="col" class="text-left">year</th> + </tr> + </thead> + <tbody> + {% for europe_date_reported in page_data.items %} + <tr> + <td class="text-right"> + {{ europe_date_reported.get_name_for_weekday() }} + </td> + <td class="text-left"> + <a href="/europe/date_reported/{{ europe_date_reported.id }}"> + {{ europe_date_reported }} + </a> + </td> + <td class="text-right"> + {{ europe_date_reported.week_of_year }} + </td> + <td class="text-left"> + {{ europe_date_reported.year }} + </td> + </tr> + {% endfor %} + </tbody> + <tfoot class="table-secondary"> + <tr> + <th scope="col" class="text-right">day of week</th> + <th scope="col" class="text-left">date reported</th> + <th scope="col" class="text-right">week of year</th> + <th scope="col" class="text-left">year</th> + </tr> + </tfoot> </table> \ No newline at end of file