From 96047d64ec64391fb75bde81d3a9ce5da3254282 Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Thu, 28 Jan 2021 18:51:04 +0100 Subject: [PATCH] work --- org/woehlke/covid19/europe/europe_model.py | 21 ++++++++++++ .../fragments/fragment_europe_navtabs.html | 6 ++-- .../fragment_europe_table_continent.html | 8 ++--- .../fragment_europe_table_country.html | 16 +++++----- .../fragments/fragment_europe_table_data.html | 32 +++++++++---------- .../fragment_europe_table_date_reported.html | 12 +++---- 6 files changed, 58 insertions(+), 37 deletions(-) diff --git a/org/woehlke/covid19/europe/europe_model.py b/org/woehlke/covid19/europe/europe_model.py index c493061c..cd49f702 100644 --- a/org/woehlke/covid19/europe/europe_model.py +++ b/org/woehlke/covid19/europe/europe_model.py @@ -96,6 +96,27 @@ 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): + 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_year_week): my_date_reported = my_date_rep.split('/') diff --git a/templates/europe/fragments/fragment_europe_navtabs.html b/templates/europe/fragments/fragment_europe_navtabs.html index 6d825d6f..25be0356 100644 --- a/templates/europe/fragments/fragment_europe_navtabs.html +++ b/templates/europe/fragments/fragment_europe_navtabs.html @@ -10,13 +10,13 @@ <a class="nav-link" href="/europe/date_reported/all">Europe date_reported</a> </li> <li class="nav-item"> - <a class="nav-link" href="/europe/continent/all">Europe continent</a> + <a class="nav-link" href="/europe/country/germany">Europe Germany</a> </li> <li class="nav-item"> - <a class="nav-link" href="/europe/country/all">Europe country</a> + <a class="nav-link" href="/europe/continent/all">Europe continent</a> </li> <li class="nav-item"> - <a class="nav-link" href="/europe/country/germany">Europe Germany</a> + <a class="nav-link" href="/europe/country/all">Europe country</a> </li> <li class="nav-item"> <a class="nav-link" href="/europe/imported">Europe imported</a> diff --git a/templates/europe/fragments/fragment_europe_table_continent.html b/templates/europe/fragments/fragment_europe_table_continent.html index 19f52e33..5e0775ea 100644 --- a/templates/europe/fragments/fragment_europe_table_continent.html +++ b/templates/europe/fragments/fragment_europe_table_continent.html @@ -1,8 +1,8 @@ <table class="table table-hover table-striped table-dark"> - <thead> - <tr> - <th scope="col">continent</th> - </tr> + <thead class="table-secondary"> + <tr> + <th scope="col">continent</th> + </tr> </thead> <tbody> {% for europe_continent in page_data.items %} diff --git a/templates/europe/fragments/fragment_europe_table_country.html b/templates/europe/fragments/fragment_europe_table_country.html index dd875de2..8fdd45cf 100644 --- a/templates/europe/fragments/fragment_europe_table_country.html +++ b/templates/europe/fragments/fragment_europe_table_country.html @@ -1,13 +1,13 @@ <table class="table table-hover table-striped table-dark"> - <thead> - <tr> - <th scope="col">countries and territories</th> - <th scope="col">population data 2019</th> - <th scope="col">geo id</th> - <th scope="col">country territory code</th> - <th scope="col">continent</th> - </tr> + <thead class="table-secondary"> + <tr> + <th scope="col">countries and territories</th> + <th scope="col">population data 2019</th> + <th scope="col">geo id</th> + <th scope="col">country territory code</th> + <th scope="col">continent</th> + </tr> </thead> <tbody> {% for europe_country in page_data.items %} diff --git a/templates/europe/fragments/fragment_europe_table_data.html b/templates/europe/fragments/fragment_europe_table_data.html index 7d9dc763..bcc9355d 100644 --- a/templates/europe/fragments/fragment_europe_table_data.html +++ b/templates/europe/fragments/fragment_europe_table_data.html @@ -5,11 +5,11 @@ <th scope="col">year_week</th> <th scope="col"> {% if europe_date_reported %} - <a href="{{ url_for( 'url_europe_date_reported_one_deaths_weekly', - europe_date_reported_id=europe_date_reported.id, - page=page_data.page) }}"> - deaths weekly - </a> + <a href="{{ url_for( 'url_europe_date_reported_one_deaths_weekly', + europe_date_reported_id=europe_date_reported.id, + page=page_data.page) }}"> + deaths weekly + </a> {% endif %} {% if europe_country %} deaths weekly @@ -17,11 +17,11 @@ </th> <th scope="col"> {% if europe_date_reported %} - <a href="{{ url_for( 'url_europe_date_reported_one_cases_weekly', - europe_date_reported_id=europe_date_reported.id, - page=page_data.page) }}"> - cases weekly - </a> + <a href="{{ url_for( 'url_europe_date_reported_one_cases_weekly', + europe_date_reported_id=europe_date_reported.id, + page=page_data.page) }}"> + cases weekly + </a> {% endif %} {% if europe_country %} cases weekly @@ -29,11 +29,11 @@ </th> <th scope="col"> {% if europe_date_reported %} - <a href="{{ url_for( 'url_europe_date_reported_one_notification_rate', - europe_date_reported_id=europe_date_reported.id, - page=page_data.page) }}"> - notification rate per 100000 population 14days - </a> + <a href="{{ url_for( 'url_europe_date_reported_one_notification_rate', + europe_date_reported_id=europe_date_reported.id, + page=page_data.page) }}"> + notification rate per 100000 population 14days + </a> {% endif %} {% if europe_country %} notification rate per 100000 population 14days @@ -51,7 +51,7 @@ <tr> <td> <a href="/europe/date_reported/{{ europe_data.europe_date_reported.id }}"> - {{ europe_data.europe_date_reported.date_rep }} + {{ europe_data.europe_date_reported.get_name_for_datum() }} </a> </td> <td> diff --git a/templates/europe/fragments/fragment_europe_table_date_reported.html b/templates/europe/fragments/fragment_europe_table_date_reported.html index fc1f42ae..f842320f 100644 --- a/templates/europe/fragments/fragment_europe_table_date_reported.html +++ b/templates/europe/fragments/fragment_europe_table_date_reported.html @@ -1,16 +1,16 @@ <table class="table table-hover table-striped table-dark"> - <thead> - <tr> - <th scope="col">date reported</th> - <th scope="col">year week</th> - </tr> + <thead class="table-secondary"> + <tr> + <th scope="col">date reported</th> + <th scope="col">year week</th> + </tr> </thead> <tbody> {% for europe_date_reported in page_data.items %} <tr> <td> <a href="/europe/date_reported/{{ europe_date_reported.id }}"> - {{ europe_date_reported.date_rep }} + {{ europe_date_reported.get_name_for_datum() }} </a> </td> <td> -- GitLab