From 0c5ac2ae28811af00700158cff13a0ce9732954a Mon Sep 17 00:00:00 2001 From: Antoine Goutenoir Date: Thu, 16 Jan 2020 19:32:51 +0100 Subject: [PATCH] Actually use the counter and tweak train gcd correction. --- flaskr/__init__.py | 5 ++--- flaskr/laws/travel_emission_linear_fit.py | 4 +++- flaskr/templates/base.html | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/flaskr/__init__.py b/flaskr/__init__.py index 6344915..01d2d3f 100755 --- a/flaskr/__init__.py +++ b/flaskr/__init__.py @@ -23,6 +23,7 @@ from flaskr.extensions import ( ) from flaskr.content import content +from flaskr.core import increment_hit_counter, get_hit_counter from markdown import markdown @@ -78,6 +79,7 @@ def create_app(object_name): return dict( content=content, version=version, + visits=get_hit_counter(), ) # Markdown jinja2 filter @@ -88,9 +90,6 @@ def create_app(object_name): # Authentication Gate for the Admin @app.before_first_request def restrict_admin_url(): - - # print('VF', app.view_functions) - endpoint = 'admin.index' url = url_for(endpoint) admin_index = app.view_functions.pop(endpoint) diff --git a/flaskr/laws/travel_emission_linear_fit.py b/flaskr/laws/travel_emission_linear_fit.py index 409ee88..de6945d 100644 --- a/flaskr/laws/travel_emission_linear_fit.py +++ b/flaskr/laws/travel_emission_linear_fit.py @@ -77,7 +77,9 @@ class EmissionModel(BaseEmissionModel): } def compute_train_footprint(self, distance): - return distance * 0.023 + gcd_to_road_correction = 1.30 # See issue #32 + train_emission = 0.023 # kg/km + return gcd_to_road_correction * distance * train_emission def compute_airplane_footprint( self, diff --git a/flaskr/templates/base.html b/flaskr/templates/base.html index 7ef0b8b..7718637 100644 --- a/flaskr/templates/base.html +++ b/flaskr/templates/base.html @@ -85,6 +85,8 @@
{{ content.footer.credits }} +
+ {{ visits }} visits since 2020
IRAP -- libgit2 0.21.2