From 3c3016f8e1cf3948e92eaa28ed7bf7ae4e82f59b Mon Sep 17 00:00:00 2001 From: "13621160019@163.com" <13621160019@163.com> Date: Wed, 13 Oct 2021 21:58:36 +0800 Subject: [PATCH] updated maximum load value according to MINUTES_TO_COUNT in tenantbatch report --- myems-api/reports/tenantbatch.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/myems-api/reports/tenantbatch.py b/myems-api/reports/tenantbatch.py index f11b4c60..b2ca8635 100644 --- a/myems-api/reports/tenantbatch.py +++ b/myems-api/reports/tenantbatch.py @@ -187,8 +187,7 @@ class Reporting: # Step 5: query reporting period energy input ################################################################################################################ for tenant_id in tenant_dict: - - cursor_energy_db.execute(" SELECT energy_category_id, SUM(actual_value), max(actual_value)" + cursor_energy_db.execute(" SELECT energy_category_id, SUM(actual_value), MAX(actual_value)" " FROM tbl_tenant_input_category_hourly " " WHERE tenant_id = %s " " AND start_datetime_utc >= %s " @@ -204,7 +203,7 @@ class Reporting: for row_tenant_energy in rows_tenant_energy: if energy_category['id'] == row_tenant_energy[0]: subtotal = row_tenant_energy[1] - maximum = row_tenant_energy[2] + maximum = row_tenant_energy[2] * Decimal(60 / config.minutes_to_count) break tenant_dict[tenant_id]['values'].append(subtotal) tenant_dict[tenant_id]['maximum'].append(maximum)