From 59733232cb663c016f5a77448dafb54751d92c03 Mon Sep 17 00:00:00 2001
From: thomaswoehlke <thomas.woehlke@gmail.com>
Date: Sat, 23 Jan 2021 13:00:40 +0100
Subject: [PATCH] * Fixed #44 /europe/continent * Fixed #45 /europe/country

---
 README.md                                        |  4 ++--
 app.py                                           |  2 +-
 org/woehlke/covid19/europe/europe_model.py       |  4 +++-
 templates/europe/europe_continent_one.html       |  6 +++---
 templates/europe/fragment_europe_data_table.html | 15 +++++++++++++++
 5 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index 1590740d..783a455f 100644
--- a/README.md
+++ b/README.md
@@ -219,8 +219,8 @@ class WhoGlobalDataImportTable(db.Model):
 ### 0.0.11 Release
 * Fixed #26 /admin/database/dump
 * Fixed #43 /europe/date_reported
-* Issue #44 /europe/continent
-* Issue #45 /europe/country
+* Fixed #44 /europe/continent
+* Fixed #45 /europe/country
 * Issue #46 /europe/country/germany
 * Issue #39 SQLalchemy instead of SQL: AllModelClasses.remove_all()
 * Issue #40 SQLalchemy instead of SQL: EuropeDataImportTable.get_date_rep()
diff --git a/app.py b/app.py
index 961056b1..54f4703e 100644
--- a/app.py
+++ b/app.py
@@ -342,7 +342,7 @@ def url_europe_continent_one(continent_id, page=1):
     continent = EuropeContinent.get_by_id(continent_id)
     page_data = EuropeCountry.find_by_continent(continent, page)
     return render_template(
-        'europe/europe_continent_all.html',
+        'europe/europe_continent_one.html',
         continent=continent,
         page_data=page_data,
         page_info=page_info)
diff --git a/org/woehlke/covid19/europe/europe_model.py b/org/woehlke/covid19/europe/europe_model.py
index 9a11d4c7..7c004871 100644
--- a/org/woehlke/covid19/europe/europe_model.py
+++ b/org/woehlke/covid19/europe/europe_model.py
@@ -181,7 +181,9 @@ class EuropeCountry(db.Model):
 
     @classmethod
     def find_by_continent(cls, continent, page):
-        return db.session.query(cls).filter(cls.continent_id == continent.id).paginate(page, per_page=ITEMS_PER_PAGE)
+        return db.session.query(cls)\
+            .filter(cls.continent_id == continent.id)\
+            .paginate(page, per_page=ITEMS_PER_PAGE)
 
     @classmethod
     def get_germany(cls):
diff --git a/templates/europe/europe_continent_one.html b/templates/europe/europe_continent_one.html
index 96fa27bc..057a4696 100644
--- a/templates/europe/europe_continent_one.html
+++ b/templates/europe/europe_continent_one.html
@@ -21,7 +21,7 @@
         {% if page_data.has_prev %}
         <li class="page-item">
             <a class="page-link"
-               href="{{ url_for( 'url_europe_continent_one', page=page_data.prev_num) }}">
+               href="{{ url_for( 'url_europe_continent_one', continent_id=continent.id, page=page_data.prev_num) }}">
                 Previous
             </a>
         </li>
@@ -31,7 +31,7 @@
                 {% if page_num != page_data.page %}
                     <li class="page-item">
                         <a class="page-link"
-                           href="{{ url_for( 'url_europe_continent_one', page=page_num) }}">
+                           href="{{ url_for( 'url_europe_continent_one', continent_id=continent.id, page=page_num) }}">
                             {{ page_num }}
                         </a>
                     </li>
@@ -49,7 +49,7 @@
         {% if page_data.has_next %}
         <li class="page-item">
             <a class="page-link"
-               href="{{ url_for( 'url_europe_continent_one', page=page_data.next_num) }}">
+               href="{{ url_for( 'url_europe_continent_one', continent_id=continent.id, page=page_data.next_num) }}">
                 Next
             </a>
         </li>
diff --git a/templates/europe/fragment_europe_data_table.html b/templates/europe/fragment_europe_data_table.html
index 4519fc4e..f55ed3c5 100644
--- a/templates/europe/fragment_europe_data_table.html
+++ b/templates/europe/fragment_europe_data_table.html
@@ -4,25 +4,40 @@
             <th scope="col">date rep</th>
             <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>
+                {% endif %}
+                {% if europe_country %}
+                    deaths weekly
+                {% endif %}
             </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>
+                {% endif %}
+                {% if europe_country %}
+                    cases weekly
+                {% endif %}
             </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>
+                {% endif %}
+                {% if europe_country %}
+                    notification rate per 100000 population 14days
+                {% endif %}
             </th>
             <th scope="col">countries and territories</th>
             <th scope="col">population data 2019</th>
-- 
GitLab