Commit 40302c4f673dd1ea056da867b660cfd74d239c25

Authored by hitier
1 parent b34ae681

Fix category table to request name from

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
@@ -86,7 +86,7 @@ def charges_by_project_stacked(project_id, category="service"): @@ -86,7 +86,7 @@ def charges_by_project_stacked(project_id, category="service"):
86 sem_n, value_n0, value_n1, ....., value_nn, 86 sem_n, value_n0, value_n1, ....., value_nn,
87 """ 87 """
88 if category == 'capacity': 88 if category == 'capacity':
89 - category_table = 'service' 89 + category_table = 'capacity'
90 sql_req = """ 90 sql_req = """
91 select c.charge_rate 91 select c.charge_rate
92 from capacity c1 left join 92 from capacity c1 left join
@@ -94,7 +94,7 @@ def charges_by_project_stacked(project_id, category="service"): @@ -94,7 +94,7 @@ def charges_by_project_stacked(project_id, category="service"):
94 order by c1.id 94 order by c1.id
95 """ 95 """
96 elif category == 'service': 96 elif category == 'service':
97 - category_table = 'capacity' 97 + category_table = 'service'
98 sql_req = """ 98 sql_req = """
99 select c.charge_rate 99 select c.charge_rate
100 from service s left join 100 from service s left join
@@ -103,7 +103,7 @@ def charges_by_project_stacked(project_id, category="service"): @@ -103,7 +103,7 @@ def charges_by_project_stacked(project_id, category="service"):
103 """ 103 """
104 else: 104 else:
105 raise ValueError("Waiting for 'service' or 'capacity'") 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 categories = [c for (c,) in db.session.execute(categories_req)] 107 categories = [c for (c,) in db.session.execute(categories_req)]
108 headers = ['period']+categories 108 headers = ['period']+categories
109 all_charges = [headers] 109 all_charges = [headers]