Commit 0c5ac2ae28811af00700158cff13a0ce9732954a
1 parent
8c465c94
Exists in
master
Actually use the counter and tweak train gcd correction.
Showing
3 changed files
with
7 additions
and
4 deletions
Show diff stats
flaskr/__init__.py
@@ -23,6 +23,7 @@ from flaskr.extensions import ( | @@ -23,6 +23,7 @@ from flaskr.extensions import ( | ||
23 | ) | 23 | ) |
24 | 24 | ||
25 | from flaskr.content import content | 25 | from flaskr.content import content |
26 | +from flaskr.core import increment_hit_counter, get_hit_counter | ||
26 | 27 | ||
27 | from markdown import markdown | 28 | from markdown import markdown |
28 | 29 | ||
@@ -78,6 +79,7 @@ def create_app(object_name): | @@ -78,6 +79,7 @@ def create_app(object_name): | ||
78 | return dict( | 79 | return dict( |
79 | content=content, | 80 | content=content, |
80 | version=version, | 81 | version=version, |
82 | + visits=get_hit_counter(), | ||
81 | ) | 83 | ) |
82 | 84 | ||
83 | # Markdown jinja2 filter | 85 | # Markdown jinja2 filter |
@@ -88,9 +90,6 @@ def create_app(object_name): | @@ -88,9 +90,6 @@ def create_app(object_name): | ||
88 | # Authentication Gate for the Admin | 90 | # Authentication Gate for the Admin |
89 | @app.before_first_request | 91 | @app.before_first_request |
90 | def restrict_admin_url(): | 92 | def restrict_admin_url(): |
91 | - | ||
92 | - # print('VF', app.view_functions) | ||
93 | - | ||
94 | endpoint = 'admin.index' | 93 | endpoint = 'admin.index' |
95 | url = url_for(endpoint) | 94 | url = url_for(endpoint) |
96 | admin_index = app.view_functions.pop(endpoint) | 95 | admin_index = app.view_functions.pop(endpoint) |
flaskr/laws/travel_emission_linear_fit.py
@@ -77,7 +77,9 @@ class EmissionModel(BaseEmissionModel): | @@ -77,7 +77,9 @@ class EmissionModel(BaseEmissionModel): | ||
77 | } | 77 | } |
78 | 78 | ||
79 | def compute_train_footprint(self, distance): | 79 | def compute_train_footprint(self, distance): |
80 | - return distance * 0.023 | 80 | + gcd_to_road_correction = 1.30 # See issue #32 |
81 | + train_emission = 0.023 # kg/km | ||
82 | + return gcd_to_road_correction * distance * train_emission | ||
81 | 83 | ||
82 | def compute_airplane_footprint( | 84 | def compute_airplane_footprint( |
83 | self, | 85 | self, |
flaskr/templates/base.html
@@ -85,6 +85,8 @@ | @@ -85,6 +85,8 @@ | ||
85 | </div> | 85 | </div> |
86 | <div class="col-lg-4 text-center"> | 86 | <div class="col-lg-4 text-center"> |
87 | {{ content.footer.credits }} | 87 | {{ content.footer.credits }} |
88 | + <br> | ||
89 | + {{ visits }} visits since 2020 | ||
88 | </div> | 90 | </div> |
89 | <div class="col-lg-4 text-center"> | 91 | <div class="col-lg-4 text-center"> |
90 | <a href="http://www.irap.omp.eu" class=""><img src="/static/img/irap.png" alt="IRAP" width="110px"></a> | 92 | <a href="http://www.irap.omp.eu" class=""><img src="/static/img/irap.png" alt="IRAP" width="110px"></a> |