diff --git a/org/woehlke/covid19/who/who_model.py b/org/woehlke/covid19/who/who_model.py index bf7fbe0e116b95f7a011523de3ef8d1a1ce743de..2a18a57da4b14c3b53189ac959aac7cc3ba63def 100644 --- a/org/woehlke/covid19/who/who_model.py +++ b/org/woehlke/covid19/who/who_model.py @@ -96,6 +96,27 @@ class WhoDateReported(db.Model): day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) + def __str__(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 + + def get_name_for_weekday(self): + return self.get_names_for_weekday()[self.day_of_week] + + @classmethod + def get_names_for_weekday(cls): + return {1: "Montag", 2: "Dienstag", 3: "Mittwoch", 4: "Donnerstag", 5: "Freitag", 6: "Samstag", + 7: "Sonntag"} + @classmethod def create_new_object_factory(cls, my_date_rep): my_datum = date.fromisoformat(my_date_rep) diff --git a/templates/who/date_reported/who_date_reported_all.html b/templates/who/date_reported/who_date_reported_all.html index 9323549514d01e84911a7907534a21baa7bc22c3..a748ddbaf56d70f2d8d5c67c4828cf7870e5c986 100644 --- a/templates/who/date_reported/who_date_reported_all.html +++ b/templates/who/date_reported/who_date_reported_all.html @@ -55,17 +55,29 @@ <table class="table table-hover table-striped table-dark"> <thead> <tr> - <th scope="col">date reported</th> + <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 who_date_reported in page_data.items %} <tr> - <td> + <td class="text-right"> + {{ who_date_reported.get_name_for_weekday() }} + </td> + <td class="text-left"> <a href="/who/date_reported/{{ who_date_reported.id }}"> - {{ who_date_reported.datum }} + {{ who_date_reported }} </a> </td> + <td class="text-right"> + {{ who_date_reported.week_of_year }} + </td> + <td class="text-left"> + {{ who_date_reported.year }} + </td> </tr> {% endfor %} </tbody> diff --git a/templates/who/fragments/fragment_who_table_global_data.html b/templates/who/fragments/fragment_who_table_global_data.html index b235a112fcbc7ce0dd5d4826d12963633659f193..98d5013bf2819b26995ae9fb226eb613d96c54e7 100644 --- a/templates/who/fragments/fragment_who_table_global_data.html +++ b/templates/who/fragments/fragment_who_table_global_data.html @@ -16,7 +16,7 @@ <tr> <th> <a href="/who/date_reported/{{ who_global_data.date_reported.id }}"> - {{ who_global_data.date_reported.date_reported }} + {{ who_global_data.date_reported }} </a> </th> <td>{{ who_global_data.deaths_new }}</td> diff --git a/templates/who/fragments/fragment_who_table_global_data_country.html b/templates/who/fragments/fragment_who_table_global_data_country.html index 04ebb52f25e26271d6148ecb966b9b8d22b42d50..d3b4f5a5bb659b38cbaa09a9a8b4a584f4bed6d7 100644 --- a/templates/who/fragments/fragment_who_table_global_data_country.html +++ b/templates/who/fragments/fragment_who_table_global_data_country.html @@ -34,7 +34,7 @@ <tr> <th> <a href="/who/date_reported/{{ who_global_data.date_reported.id }}"> - {{ who_global_data.date_reported.date_reported }} + {{ who_global_data.date_reported }} </a> </th> <td> diff --git a/templates/who/fragments/fragment_who_table_global_data_date_reported.html b/templates/who/fragments/fragment_who_table_global_data_date_reported.html index 16e7177faaa0766fbf8f80af69acd1885bb22fbc..f4b0572dfc4a2824f44a6eebd59c0a239b564d92 100644 --- a/templates/who/fragments/fragment_who_table_global_data_date_reported.html +++ b/templates/who/fragments/fragment_who_table_global_data_date_reported.html @@ -34,7 +34,7 @@ <tr> <th> <a href="/who/date_reported/{{ who_global_data.date_reported.id }}"> - {{ who_global_data.date_reported.date_reported }} + {{ who_global_data.date_reported }} </a> </th> <td>