From 29a1d1c198d9e7cad24e5c9961651a094fc39526 Mon Sep 17 00:00:00 2001 From: Antoine Goutenoir Date: Thu, 2 Apr 2020 16:26:40 +0200 Subject: [PATCH] Rename columns in the estimation output CSV file. --- flaskr/controllers/main_controller.py | 6 ++++-- flaskr/templates/estimation.html | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/flaskr/controllers/main_controller.py b/flaskr/controllers/main_controller.py index 82b6b4e..8d23aa2 100644 --- a/flaskr/controllers/main_controller.py +++ b/flaskr/controllers/main_controller.py @@ -722,8 +722,10 @@ def consult_estimation(public_id, extension): cw = csv.writer(si, quoting=csv.QUOTE_ALL) cw.writerow([ u"city", u"country", u"address", - u"co2 (kg)", u"distance (km)", - u"plane trips", u'train trips', + u"co2_kg", + u"distance_km", + u"plane trips_amount", + u'train trips_amount', ]) results = estimation.get_output_dict() diff --git a/flaskr/templates/estimation.html b/flaskr/templates/estimation.html index 233de8f..67e75cf 100644 --- a/flaskr/templates/estimation.html +++ b/flaskr/templates/estimation.html @@ -1,9 +1,11 @@ {% extends "base.html" %} + {% block title %}Estimation {{ estimation.public_id }} of your ✈ travel footprint{% endblock %} + {% block hero %}
{% if estimation.has_failed() %} @@ -341,10 +343,10 @@ jQuery(document).ready(function($){ var vizid = "#cities_footprints_d3viz_lollipop"; var csvUrl = "/estimation/{{ estimation.public_id }}.csv"; var y_key = 'city'; - var x_key = 'co2 (kg)'; + var x_key = 'co2_kg'; var margin = {top: 40, right: 40, bottom: 150, left: 180}, - height = Math.max(300, 100+16*plots_config['cities_count']) - margin.top - margin.bottom; + 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; @@ -367,7 +369,9 @@ jQuery(document).ready(function($){ d3.csv(csvUrl, function (data) { // Extrema - var data_x_max = d3.max(data, function (d) { return parseFloat(d[x_key]); }); + var data_x_max = d3.max(data, function (d) { + return parseFloat(d[x_key]); + }); var axis_x_max = ceil_value_to_magnitude(data_x_max); // X axis -- libgit2 0.21.2