updated maximum load value according to MINUTES_TO_COUNT in tenantbatch report

pull/69/head
13621160019@163.com 2021-10-13 21:58:36 +08:00
parent d78db4c23e
commit 3c3016f8e1
1 changed files with 2 additions and 3 deletions

View File

@ -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)