From 796a568895dc58a39939b2d05b418e4861f599c9 Mon Sep 17 00:00:00 2001 From: Richard Hitier Date: Mon, 19 Apr 2021 11:05:38 +0200 Subject: [PATCH] Add % sign in charge columns --- app/commands/commands.py | 2 ++ app/main/templates/agent.html | 8 ++++++-- app/main/templates/agents.html | 2 +- app/main/templates/projects.html | 4 +--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/commands/commands.py b/app/commands/commands.py index 02130f0..7cde95d 100644 --- a/app/commands/commands.py +++ b/app/commands/commands.py @@ -131,6 +131,8 @@ def feed_from_irap(csv_file_name): for period_name in range(2011, 2030): t = Period.query.filter(Period.name == period_name).one() charge = r[f"{period_name}"] + # Charge are stored as percent in db, but as fraction of ETP in irap csv + # we make the conversion here. try: charge = int(100 * float(charge)) except ValueError: diff --git a/app/main/templates/agent.html b/app/main/templates/agent.html index 1af89b6..5b19beb 100644 --- a/app/main/templates/agent.html +++ b/app/main/templates/agent.html @@ -17,8 +17,12 @@ {% for line in charges[1:] %} - {% for cell in line %} - {{cell}} + {% for i in range(line|length) %} + {%if 'Charge' in charges[0][i] %} + {{line[i]}} % + {%else%} + {{line[i]}} + {%endif%} {% endfor %} {% endfor %} diff --git a/app/main/templates/agents.html b/app/main/templates/agents.html index 7803bed..affd95e 100644 --- a/app/main/templates/agents.html +++ b/app/main/templates/agents.html @@ -15,7 +15,7 @@ {{ agent.firstname }} {{ agent.secondname }} - {{agent.total_charge}} + {{agent.total_charge}} % {{agent.num_projects}} {% endfor %} diff --git a/app/main/templates/projects.html b/app/main/templates/projects.html index fc2a43e..05adad5 100644 --- a/app/main/templates/projects.html +++ b/app/main/templates/projects.html @@ -13,9 +13,7 @@ {{ project.name }} - - {{ project.total_charge }} - + {{ project.total_charge }} % {% endfor %} -- libgit2 0.21.2