diff --git a/flaskr/controllers/main_controller.py b/flaskr/controllers/main_controller.py index cde195d..38a715b 100644 --- a/flaskr/controllers/main_controller.py +++ b/flaskr/controllers/main_controller.py @@ -254,7 +254,7 @@ def compute(): # process the queue of estimation requests if not _estimation.warnings: _estimation.warnings = _warning_message else: - _estimation.warnings += u"\n" + _warning_message + _estimation.warnings += _warning_message # _estimation.warnings = u"%s\n%s" % \ # (_estimation.warnings, _warning_message) db.session.commit() diff --git a/flaskr/models.py b/flaskr/models.py index d936439..ecbdca8 100755 --- a/flaskr/models.py +++ b/flaskr/models.py @@ -12,7 +12,6 @@ from yaml import safe_load as yaml_load from content import get_path - # These are not the emission "models" in the scientific meaning of the word. # They are the SQL Database Models. # These are also named Entities, in other conventions (we're following flasks") @@ -73,6 +72,22 @@ class Estimation(db.Model): errors = db.Column(db.UnicodeText()) @property + def link(self): + return u"https://travel-footprint-calculator.irap.omp.eu/estimation/%s.html" \ + % self.public_id + + @property + def author_name(self): + s = u"" + if self.first_name: + s += self.first_name + if self.last_name: + s += (u" " if s else u"") + self.last_name + if self.institution: + s += (u" " if s else u"") + self.institution + return s + + @property def origins_count(self): return self.origin_addresses.strip().count("\n") + 1 @@ -153,14 +168,16 @@ class Estimation(db.Model): return self._models +# BACKOFFICE CONFIGURATION #################################################### + class EstimationView(ModelView): # Show only name and email columns in list view column_list = ( 'public_id', + 'link', 'run_name', 'status', - 'first_name', - 'last_name', + 'author_name', 'models_slugs', 'scenario', 'origins_count', @@ -173,7 +190,7 @@ class EstimationView(ModelView): # name and email fields # column_searchable_list = ('name', 'email') - column_filters = ('first_name', 'last_name') + column_filters = ('first_name', 'last_name', 'status') # USERS ####################################################################### diff --git a/flaskr/templates/estimation.html b/flaskr/templates/estimation.html index 8763afb..0522e06 100644 --- a/flaskr/templates/estimation.html +++ b/flaskr/templates/estimation.html @@ -68,6 +68,23 @@ + +
+{% endif %} + +{% if estimation.warnings %} +
+
+
+

Warnings

+
+{{ estimation.warnings }}
+            
+
+
+
+ +
{% endif %} {% if not estimation.has_failed() %} @@ -171,18 +188,6 @@
-{% if estimation.warnings %} -
-
-
-

Warnings

-
-{{ estimation.warnings }}
-            
-
-
-
-{% endif %} {#
#} {#
#} @@ -334,7 +339,7 @@ jQuery(document).ready(function($){ var y_key = 'city'; var x_key = 'co2 (kg)'; - var margin = {top: 40, right: 40, bottom: 150, left: 150}, + var margin = {top: 40, right: 40, bottom: 150, left: 180}, height = Math.max(300, 100+16*plots_config['cities_count']) - margin.top - margin.bottom; var width = Math.max(880, $(vizid).parent().width()); width = width - margin.left - margin.right; -- libgit2 0.21.2