From 17b05589e34860c0dd8d6a81d13f13421b1d9023 Mon Sep 17 00:00:00 2001 From: Richard Hitier Date: Fri, 2 Apr 2021 11:04:01 +0200 Subject: [PATCH] Change agent csv content type and tiny html --- app/main/routes.py | 5 +++-- app/main/templates/agent.html | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/main/routes.py b/app/main/routes.py index f40c5b9..aab8ee9 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -127,13 +127,14 @@ def charge_agent_csv(agent_id): line_string = ",".join(line) csv_table.append(line_string) resp = make_response("\n".join(csv_table)) - resp.headers['Content-Type'] = 'text/csv' + resp.headers['Content-Type'] = 'text/plain;charset=utf8' return resp @bp.route('/charge/agent/json/') @role_required('service') def charge_agent_json(agent_id): - resp = make_response(json.dumps(db_mgr.charges_by_agent_stacked(agent_id))) + stacked_charges = db_mgr.charges_by_agent_stacked(agent_id) + resp = make_response(json.dumps(stacked_charges)) resp.headers['Content-Type'] = 'application/json' return resp diff --git a/app/main/templates/agent.html b/app/main/templates/agent.html index 9b05763..5b51c35 100644 --- a/app/main/templates/agent.html +++ b/app/main/templates/agent.html @@ -5,7 +5,7 @@ {% endblock %} {% block content %} -
+
@@ -45,7 +45,7 @@ const y = d3.scaleLinear() .range([height, 0]); - const svg = d3.select("#charge_div").append("svg") + const svg = d3.select("#agent_projects_chart").append("svg") .attr("id", "svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) @@ -153,7 +153,7 @@ // ---------------- // Create a tooltip // ---------------- - var tooltip = d3.select("#charge_div") + var tooltip = d3.select("#agent_projects_chart") .append("div") .style("opacity", 0) .attr("class", "tooltip") -- libgit2 0.21.2