From d04b8c9d4cfff95fde564ed029588f905a13fde9 Mon Sep 17 00:00:00 2001 From: YangZhang-GitHub <2533471770@qq.com> Date: Tue, 27 Apr 2021 17:29:36 +0800 Subject: [PATCH] Added 'excelexporters.spaceefficiency.export()' method --- myems-api/reports/spaceefficiency.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/myems-api/reports/spaceefficiency.py b/myems-api/reports/spaceefficiency.py index afdd3e2f..f8bde890 100644 --- a/myems-api/reports/spaceefficiency.py +++ b/myems-api/reports/spaceefficiency.py @@ -5,6 +5,7 @@ import config from datetime import datetime, timedelta, timezone from core import utilities from decimal import Decimal +import excelexporters.spaceefficiency class Reporting: @@ -729,5 +730,11 @@ class Reporting: "timestamps": parameters_data['timestamps'], "values": parameters_data['values'] } - + # export result to Excel file and then encode the file to base64 string + result['excel_bytes_base64'] = excelexporters.spaceefficiency.export(result, + space['name'], + reporting_start_datetime_local, + reporting_end_datetime_local, + period_type) + resp.body = json.dumps(result)