Commit 40302c4f673dd1ea056da867b660cfd74d239c25
1 parent
b34ae681
Exists in
master
and in
4 other branches
Fix category table to request name from
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
app/db_mgr.py
... | ... | @@ -86,7 +86,7 @@ def charges_by_project_stacked(project_id, category="service"): |
86 | 86 | sem_n, value_n0, value_n1, ....., value_nn, |
87 | 87 | """ |
88 | 88 | if category == 'capacity': |
89 | - category_table = 'service' | |
89 | + category_table = 'capacity' | |
90 | 90 | sql_req = """ |
91 | 91 | select c.charge_rate |
92 | 92 | from capacity c1 left join |
... | ... | @@ -94,7 +94,7 @@ def charges_by_project_stacked(project_id, category="service"): |
94 | 94 | order by c1.id |
95 | 95 | """ |
96 | 96 | elif category == 'service': |
97 | - category_table = 'capacity' | |
97 | + category_table = 'service' | |
98 | 98 | sql_req = """ |
99 | 99 | select c.charge_rate |
100 | 100 | from service s left join |
... | ... | @@ -103,7 +103,7 @@ def charges_by_project_stacked(project_id, category="service"): |
103 | 103 | """ |
104 | 104 | else: |
105 | 105 | raise ValueError("Waiting for 'service' or 'capacity'") |
106 | - categories_req = "select name from {} order by id".format(category) | |
106 | + categories_req = "select name from {} order by id".format(category_table) | |
107 | 107 | categories = [c for (c,) in db.session.execute(categories_req)] |
108 | 108 | headers = ['period']+categories |
109 | 109 | all_charges = [headers] | ... | ... |