Commit 796a568895dc58a39939b2d05b418e4861f599c9

Authored by hitier
1 parent 083ac872

Add % sign in charge columns

app/commands/commands.py
@@ -131,6 +131,8 @@ def feed_from_irap(csv_file_name): @@ -131,6 +131,8 @@ def feed_from_irap(csv_file_name):
131 for period_name in range(2011, 2030): 131 for period_name in range(2011, 2030):
132 t = Period.query.filter(Period.name == period_name).one() 132 t = Period.query.filter(Period.name == period_name).one()
133 charge = r[f"{period_name}"] 133 charge = r[f"{period_name}"]
  134 + # Charge are stored as percent in db, but as fraction of ETP in irap csv
  135 + # we make the conversion here.
134 try: 136 try:
135 charge = int(100 * float(charge)) 137 charge = int(100 * float(charge))
136 except ValueError: 138 except ValueError:
app/main/templates/agent.html
@@ -17,8 +17,12 @@ @@ -17,8 +17,12 @@
17 <tbody> 17 <tbody>
18 {% for line in charges[1:] %} 18 {% for line in charges[1:] %}
19 <tr> 19 <tr>
20 - {% for cell in line %}  
21 - <td>{{cell}}</td> 20 + {% for i in range(line|length) %}
  21 + {%if 'Charge' in charges[0][i] %}
  22 + <td>{{line[i]}} %</td>
  23 + {%else%}
  24 + <td>{{line[i]}}</td>
  25 + {%endif%}
22 {% endfor %} 26 {% endfor %}
23 </tr> 27 </tr>
24 {% endfor %} 28 {% endfor %}
app/main/templates/agents.html
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 {{ agent.firstname }} 15 {{ agent.firstname }}
16 {{ agent.secondname }} 16 {{ agent.secondname }}
17 </a></td> 17 </a></td>
18 - <td>{{agent.total_charge}}</td> 18 + <td>{{agent.total_charge}} %</td>
19 <td>{{agent.num_projects}}</td> 19 <td>{{agent.num_projects}}</td>
20 </tr> 20 </tr>
21 {% endfor %} 21 {% endfor %}
app/main/templates/projects.html
@@ -13,9 +13,7 @@ @@ -13,9 +13,7 @@
13 <td><a href="{{url_for('main.project', project_id=project.id)}}"> 13 <td><a href="{{url_for('main.project', project_id=project.id)}}">
14 {{ project.name }}</a> 14 {{ project.name }}</a>
15 </td> 15 </td>
16 - <td>  
17 - {{ project.total_charge }}</a>  
18 - </td> 16 + <td>{{ project.total_charge }} % </td>
19 </tr> 17 </tr>
20 {% endfor %} 18 {% endfor %}
21 </tbody> 19 </tbody>