diff --git a/README.md b/README.md index e551f4c2750d8077d2ede79ee4ab2e4d525ef59f..10f09c40679cc56f9c3461e7100aa3928f40d465 100644 --- a/README.md +++ b/README.md @@ -221,13 +221,14 @@ class WhoGlobalDataImportTable(db.Model): * Issue #43 /europe/date_reported * Issue #44 /europe/continent * Issue #45 /europe/country -* Issue #46 /europe/data +* Issue #46 /europe/country/germany * Issue #39 SQLalchemy instead of SQL: AllModelClasses.remove_all() * Issue #40 SQLalchemy instead of SQL: EuropeDataImportTable.get_date_rep() * Issue #41 SQLalchemy instead of SQL: EuropeDataImportTable.get_countries_of_continent() * Issue #42 SQLalchemy instead of SQL: WhoGlobalDataImportTable.get_new_dates_as_array() * Issue #49 EuropeServiceUpdate.__update_data_short() * Issue #50 remove unused requirements from requirements.txt +* Issue #51 /europe/imported ### 0.0.12 Release * Issue #5 Visual Graphs for Data per Countries order by Date diff --git a/app.py b/app.py index 834f9dfc6cf686619d2abda87c29a64d6179d8d9..8ac85d1bd4d11a9665165edbf830c6bd3118386e 100644 --- a/app.py +++ b/app.py @@ -348,7 +348,7 @@ def url_europe_country_one(country_id, page=1): @app.route('/europe/country/germany') def url_europe_country_germany(country_id, page=1): page_info = ApplicationPage('Europe', "country") - europe_country = EuropeCountry.get_by_id(country_id) + europe_country = EuropeCountry.get_germany() page_data = EuropeData.find_by_country(europe_country, page) return render_template( 'europe/europe_country_germany.html', @@ -357,17 +357,17 @@ def url_europe_country_germany(country_id, page=1): page_info=page_info) -@app.route('/europe/data/page/<int:page>') -@app.route('/europe/data') -def url_europe_data(page=1): - page_info = ApplicationPage('Europe', "europe_data") - page_data = EuropeData.get_all_as_page(page) - return render_template( - 'europe/europe_data.html', - page_data=page_data, - page_info=page_info) - - +#@app.route('/europe/data/page/<int:page>') +#@app.route('/europe/data') +#def url_europe_data(page=1): +# page_info = ApplicationPage('Europe', "europe_data") +# page_data = EuropeData.get_all_as_page(page) +# return render_template( +# 'europe/europe_data.html', +# page_data=page_data, +# page_info=page_info) +# +# ################################################################################################################## # # RKI diff --git a/org/woehlke/covid19/europe/europe_model.py b/org/woehlke/covid19/europe/europe_model.py index 03ab1c5bda5362158ad48772e38a84318a614892..ad75fd37ecd3bb1fb36e74705eb659f79f479935 100644 --- a/org/woehlke/covid19/europe/europe_model.py +++ b/org/woehlke/covid19/europe/europe_model.py @@ -27,6 +27,7 @@ class EuropeDataImportTable(db.Model): @classmethod def get_all_as_page(cls, page): + #TODO: #51 order_by: year_week, country return db.session.query(cls).paginate(page, per_page=ITEMS_PER_PAGE) @classmethod @@ -182,6 +183,11 @@ class EuropeCountry(db.Model): 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) + @classmethod + def get_germany(cls): + #TODO: + pass + class EuropeData(db.Model): __tablename__ = 'europe_data' diff --git a/templates/europe/europe_country_germany.html b/templates/europe/europe_country_germany.html new file mode 100644 index 0000000000000000000000000000000000000000..0dcb194cb9b932aa9d8574e9db27716df0cc575b --- /dev/null +++ b/templates/europe/europe_country_germany.html @@ -0,0 +1,66 @@ +{% extends 'page_layout.html' %} + +{% block navigation_navtabs %} + {% include 'fragment_navtabs_europe.html' %} +{% endblock %} + +{% block main_container %} + + {% if page_data.pages > 1 %} + <ul class="pagination"> + {% if page_data.has_prev %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for( 'url_europe_country_germany', + country_id=europe_country.id, + page=page_data.prev_num) }}"> + Previous + </a> + </li> + {% endif %} + {% for page_num in page_data.iter_pages() %} + {% if page_num %} + {% if page_num != page_data.page %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for( 'url_europe_country_germany', + country_id=europe_country.id, + page=page_num) }}"> + {{ page_num }} + </a> + </li> + {% else %} + <li class="page-item active"> + <a class="page-link" href="#">{{ page_num }}</a> + </li> + {% endif %} + {% else %} + <li class="page-item"> + <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> + </li> + {% endif %} + {% endfor %} + {% if page_data.has_next %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for( 'url_europe_country_germany', + country_id=europe_country.id, page=page_data.next_num) }}"> + Next + </a> + </li> + {% endif %} + </ul> + {% endif %} + + {% include 'europe/fragment_europe_data_table.html' %} + +{% endblock %} + + +{% block footer_container %} + <div> + {% for error in errors %} + <h4>{{ error }}</h4> + {% endfor %} + </div> +{% endblock %} diff --git a/templates/europe/fragment_europe_data_imported_table.html b/templates/europe/fragment_europe_data_imported_table.html index 9c2f5bffa61c3254c77b4eda54aa423d7a85acd0..9444ac384f88aa3fcfec555b6ddb1bb22d3a8837 100644 --- a/templates/europe/fragment_europe_data_imported_table.html +++ b/templates/europe/fragment_europe_data_imported_table.html @@ -1,16 +1,16 @@ <table class="table table-hover table-striped table-dark"> <thead> <tr> - <th scope="col">date_rep</th> + <th scope="col">date reported</th> <th scope="col">year_week</th> - <th scope="col">cases_weekly</th> - <th scope="col">deaths_weekly</th> - <th scope="col">pop_data_2019</th> - <th scope="col">countries_and_territories</th> - <th scope="col">geo_id</th> - <th scope="col">country_territory_code</th> - <th scope="col">continent_exp</th> - <th scope="col">notification_rate_per_100000_population_14days</th> + <th scope="col">cases weekly</th> + <th scope="col">deaths weekly</th> + <th scope="col">population data 2019</th> + <th scope="col">countries and territories</th> + <th scope="col">geo id</th> + <th scope="col">country territory code</th> + <th scope="col">continent</th> + <th scope="col">notification rate per 100000 population 14days</th> </tr> </thead> <tbody> diff --git a/templates/fragment_navtabs_europe.html b/templates/fragment_navtabs_europe.html index 46ac51034091e6e77ce5ad3966b59c49ef7d78b8..a4ff34476036ebfeb9363202c724fe4ee7976ade 100644 --- a/templates/fragment_navtabs_europe.html +++ b/templates/fragment_navtabs_europe.html @@ -15,9 +15,6 @@ <li class="nav-item"> <a class="nav-link" href="/europe/country/all">Europe country</a> </li> - <li class="nav-item"> - <a class="nav-link" href="/europe/data">Europe data</a> - </li> <li class="nav-item"> <a class="nav-link" href="/europe/imported">Europe imported</a> </li>