Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flask-covid19
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Wöhlke
flask-covid19
Commits
f6de797d
Commit
f6de797d
authored
3 years ago
by
thomaswoehlke
Browse files
Options
Downloads
Patches
Plain Diff
template changes
parent
1c72d9f2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/covid19/blueprints/owid/owid_model.py
+6
-0
6 additions, 0 deletions
src/covid19/blueprints/owid/owid_model.py
src/covid19/blueprints/owid/owid_views.py
+26
-20
26 additions, 20 deletions
src/covid19/blueprints/owid/owid_views.py
with
32 additions
and
20 deletions
src/covid19/blueprints/owid/owid_model.py
+
6
−
0
View file @
f6de797d
...
@@ -94,6 +94,12 @@ class OwidCountry(db.Model):
...
@@ -94,6 +94,12 @@ class OwidCountry(db.Model):
result
+=
"
"
result
+=
"
"
return
result
return
result
@classmethod
def
get_germany
(
cls
):
iso_code
=
'
DEU
'
location
=
'
Germany
'
return
db
.
session
.
query
(
cls
).
filter
(
and_
((
cls
.
iso_code
==
iso_code
),
(
cls
.
location
==
location
))).
one_or_none
()
@classmethod
@classmethod
def
get_countries_for_continent
(
cls
,
owid_continent_one
:
OwidContinent
,
page
:
int
):
def
get_countries_for_continent
(
cls
,
owid_continent_one
:
OwidContinent
,
page
:
int
):
return
db
.
session
.
query
(
cls
).
filter
(
cls
.
continent
==
owid_continent_one
).
paginate
(
page
,
per_page
=
ITEMS_PER_PAGE
)
return
db
.
session
.
query
(
cls
).
filter
(
cls
.
continent
==
owid_continent_one
).
paginate
(
page
,
per_page
=
ITEMS_PER_PAGE
)
...
...
This diff is collapsed.
Click to expand it.
src/covid19/blueprints/owid/owid_views.py
+
26
−
20
View file @
f6de797d
...
@@ -211,21 +211,6 @@ def url_owid_tasks():
...
@@ -211,21 +211,6 @@ def url_owid_tasks():
page_info
=
page_info
)
page_info
=
page_info
)
@app_owid.route
(
'
/test/page/<int:page>
'
)
@app_owid.route
(
'
/test
'
)
def
url_owid_test
(
page
=
1
):
page_info
=
ApplicationPage
(
'
OWID
'
,
"
Test
"
)
try
:
page_data
=
OwidImport
.
get_continents
(
page
)
except
OperationalError
:
flash
(
message
=
"
No data in the database.
"
,
category
=
"
error
"
)
page_data
=
None
return
render_template
(
'
owid/owid_test.html
'
,
page_data
=
page_data
,
page_info
=
page_info
)
@app_owid.route
(
'
/imported/page/<int:page>
'
)
@app_owid.route
(
'
/imported/page/<int:page>
'
)
@app_owid.route
(
'
/imported
'
)
@app_owid.route
(
'
/imported
'
)
def
url_owid_imported
(
page
=
1
):
def
url_owid_imported
(
page
=
1
):
...
@@ -258,7 +243,7 @@ def url_owid_date_reported_all(page: int = 1):
...
@@ -258,7 +243,7 @@ def url_owid_date_reported_all(page: int = 1):
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/page/<int:page>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/page/<int:page>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>
'
)
def
url_owid_date_reported
(
date_reported_id
:
int
,
page
:
int
=
1
):
def
url_owid_date_reported
_one
(
date_reported_id
:
int
,
page
:
int
=
1
):
date_reported
=
OwidDateReported
.
get_by_id
(
date_reported_id
)
date_reported
=
OwidDateReported
.
get_by_id
(
date_reported_id
)
page_info
=
ApplicationPage
(
page_info
=
ApplicationPage
(
"
Date Reported:
"
+
date_reported
.
date_reported
,
"
Date Reported:
"
+
date_reported
.
date_reported
,
...
@@ -279,7 +264,7 @@ def url_owid_date_reported(date_reported_id: int, page: int = 1):
...
@@ -279,7 +264,7 @@ def url_owid_date_reported(date_reported_id: int, page: int = 1):
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/cases_new/page/<int:page>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/cases_new/page/<int:page>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/cases_new
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/cases_new
'
)
def
url_owid_date_reported_cases_new
(
date_reported_id
:
int
,
page
:
int
=
1
):
def
url_owid_date_reported_
one_
cases_new
(
date_reported_id
:
int
,
page
:
int
=
1
):
date_reported
=
OwidDateReported
.
get_by_id
(
date_reported_id
)
date_reported
=
OwidDateReported
.
get_by_id
(
date_reported_id
)
page_info
=
ApplicationPage
(
page_info
=
ApplicationPage
(
"
Date Reported:
"
+
date_reported
.
date_reported
,
"
Date Reported:
"
+
date_reported
.
date_reported
,
...
@@ -300,7 +285,7 @@ def url_owid_date_reported_cases_new(date_reported_id: int, page: int = 1):
...
@@ -300,7 +285,7 @@ def url_owid_date_reported_cases_new(date_reported_id: int, page: int = 1):
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/cases_cumulative/page/<int:page>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/cases_cumulative/page/<int:page>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/cases_cumulative
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/cases_cumulative
'
)
def
url_owid_date_reported_cases_cumulative
(
date_reported_id
:
int
,
page
:
int
=
1
):
def
url_owid_date_reported_
one_
cases_cumulative
(
date_reported_id
:
int
,
page
:
int
=
1
):
date_reported
=
OwidDateReported
.
get_by_id
(
date_reported_id
)
date_reported
=
OwidDateReported
.
get_by_id
(
date_reported_id
)
page_info
=
ApplicationPage
(
page_info
=
ApplicationPage
(
"
Date Reported:
"
+
date_reported
.
date_reported
,
"
Date Reported:
"
+
date_reported
.
date_reported
,
...
@@ -321,7 +306,7 @@ def url_owid_date_reported_cases_cumulative(date_reported_id: int, page: int = 1
...
@@ -321,7 +306,7 @@ def url_owid_date_reported_cases_cumulative(date_reported_id: int, page: int = 1
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/deaths_new/page/<int:page>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/deaths_new/page/<int:page>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/deaths_new
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/deaths_new
'
)
def
url_owid_date_reported_deaths_new
(
date_reported_id
:
int
,
page
:
int
=
1
):
def
url_owid_date_reported_
one_
deaths_new
(
date_reported_id
:
int
,
page
:
int
=
1
):
date_reported
=
OwidDateReported
.
get_by_id
(
date_reported_id
)
date_reported
=
OwidDateReported
.
get_by_id
(
date_reported_id
)
page_info
=
ApplicationPage
(
page_info
=
ApplicationPage
(
"
Date Reported:
"
+
date_reported
.
date_reported
,
"
Date Reported:
"
+
date_reported
.
date_reported
,
...
@@ -342,7 +327,7 @@ def url_owid_date_reported_deaths_new(date_reported_id: int, page: int = 1):
...
@@ -342,7 +327,7 @@ def url_owid_date_reported_deaths_new(date_reported_id: int, page: int = 1):
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/deaths_cumulative/page/<int:page>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/deaths_cumulative/page/<int:page>
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/deaths_cumulative
'
)
@app_owid.route
(
'
/date_reported/<int:date_reported_id>/deaths_cumulative
'
)
def
url_owid_date_reported_deaths_cumulative
(
date_reported_id
:
int
,
page
:
int
=
1
):
def
url_owid_date_reported_
one_
deaths_cumulative
(
date_reported_id
:
int
,
page
:
int
=
1
):
date_reported
=
OwidDateReported
.
get_by_id
(
date_reported_id
)
date_reported
=
OwidDateReported
.
get_by_id
(
date_reported_id
)
page_info
=
ApplicationPage
(
page_info
=
ApplicationPage
(
"
Date Reported:
"
+
date_reported
.
date_reported
,
"
Date Reported:
"
+
date_reported
.
date_reported
,
...
@@ -439,6 +424,27 @@ def url_owid_country_one(country_id: int, page: int = 1):
...
@@ -439,6 +424,27 @@ def url_owid_country_one(country_id: int, page: int = 1):
page_info
=
page_info
)
page_info
=
page_info
)
@app_owid.route
(
'
/country/germany/page/<int:page>
'
)
@app_owid.route
(
'
/country/germany
'
)
def
url_owid_country_one_germany
(
page
:
int
=
1
):
owid_country_one
=
OwidCountry
.
get_germany
()
page_info
=
ApplicationPage
(
"
country:
"
+
owid_country_one
.
location
,
'
OWID
'
,
"
data for OWID continent
"
+
owid_country_one
.
region
+
"
"
)
try
:
page_data
=
OwidData
.
get_data_for_country
(
owid_country_one
,
page
)
except
OperationalError
:
flash
(
"
No data in the database.
"
)
page_data
=
None
return
render_template
(
'
owid/country/owid_country_one_germany.html
'
,
owid_country
=
owid_country_one
,
page_data
=
page_data
,
page_info
=
page_info
)
# ----------------------------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------------------
# Celery TASKS
# Celery TASKS
# ----------------------------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment