From 74706dcc37c22ddb5e5656d8b4a950c253f71424 Mon Sep 17 00:00:00 2001 From: Caozhenhui <823914102@qq.com> Date: Fri, 29 Oct 2021 16:14:16 +0800 Subject: [PATCH 01/10] added new period type 'weekly' to meterenergy in WEB UI --- web/src/components/MyEMS/common/PeriodTypeOptions.js | 1 + web/src/i18n.js | 1 + 2 files changed, 2 insertions(+) diff --git a/web/src/components/MyEMS/common/PeriodTypeOptions.js b/web/src/components/MyEMS/common/PeriodTypeOptions.js index 707262de..bf2ac204 100644 --- a/web/src/components/MyEMS/common/PeriodTypeOptions.js +++ b/web/src/components/MyEMS/common/PeriodTypeOptions.js @@ -1,5 +1,6 @@ export const periodTypeOptions = [ { value: 'yearly', label: 'Yearly' }, { value: 'monthly', label: 'Monthly' }, + { value: 'weekly', label: 'Weekly' }, { value: 'daily', label: 'Daily' }, { value: 'hourly', label: 'Hourly' }]; \ No newline at end of file diff --git a/web/src/i18n.js b/web/src/i18n.js index 428f5439..35ac6409 100644 --- a/web/src/i18n.js +++ b/web/src/i18n.js @@ -1614,6 +1614,7 @@ const resources = { "Period Types": "时间尺度", "Yearly": "年", "Monthly": "月", + "Weekly": "周", "Daily": "日", "Hourly": "时", "Submit": "提交", From 9ea6c505a599db9cfff21bfc6c261a90a48f83e9 Mon Sep 17 00:00:00 2001 From: Caozhenhui <823914102@qq.com> Date: Mon, 1 Nov 2021 11:28:07 +0800 Subject: [PATCH 02/10] Added the time scale of weekly to all required files --- myems-api/reports/combinedequipmentcost.py | 6 +++++- myems-api/reports/combinedequipmentefficiency.py | 10 +++++++++- myems-api/reports/combinedequipmentenergycategory.py | 6 +++++- myems-api/reports/combinedequipmentenergyitem.py | 6 +++++- myems-api/reports/combinedequipmentincome.py | 6 +++++- myems-api/reports/combinedequipmentload.py | 6 +++++- myems-api/reports/combinedequipmentoutput.py | 6 +++++- myems-api/reports/combinedequipmentsaving.py | 10 +++++++++- myems-api/reports/combinedequipmentstatistics.py | 6 +++++- myems-api/reports/dashboard.py | 10 +++++++++- myems-api/reports/equipmentcost.py | 6 +++++- myems-api/reports/equipmentefficiency.py | 10 +++++++++- myems-api/reports/equipmentenergycategory.py | 6 +++++- myems-api/reports/equipmentenergyitem.py | 6 +++++- myems-api/reports/equipmentincome.py | 6 +++++- myems-api/reports/equipmentload.py | 6 +++++- myems-api/reports/equipmentoutput.py | 6 +++++- myems-api/reports/equipmentsaving.py | 10 +++++++++- myems-api/reports/equipmentstatistics.py | 6 +++++- myems-api/reports/metercost.py | 6 +++++- myems-api/reports/metersubmetersbalance.py | 8 +++++++- myems-api/reports/offlinemetercost.py | 6 +++++- myems-api/reports/offlinemeterenergy.py | 6 +++++- myems-api/reports/shopfloorcost.py | 6 +++++- myems-api/reports/shopfloorenergycategory.py | 6 +++++- myems-api/reports/shopfloorenergyitem.py | 6 +++++- myems-api/reports/shopfloorload.py | 6 +++++- myems-api/reports/shopfloorsaving.py | 10 +++++++++- myems-api/reports/shopfloorstatistics.py | 6 +++++- myems-api/reports/spacecost.py | 6 +++++- myems-api/reports/spaceefficiency.py | 10 +++++++++- myems-api/reports/spaceenergycategory.py | 6 +++++- myems-api/reports/spaceenergyitem.py | 6 +++++- myems-api/reports/spaceincome.py | 6 +++++- myems-api/reports/spaceload.py | 6 +++++- myems-api/reports/spaceoutput.py | 6 +++++- myems-api/reports/spacesaving.py | 10 +++++++++- myems-api/reports/spacestatistics.py | 6 +++++- myems-api/reports/storecost.py | 6 +++++- myems-api/reports/storeenergycategory.py | 6 +++++- myems-api/reports/storeenergyitem.py | 6 +++++- myems-api/reports/storeload.py | 6 +++++- myems-api/reports/storesaving.py | 10 +++++++++- myems-api/reports/storestatistics.py | 6 +++++- myems-api/reports/tenantbill.py | 4 ++++ myems-api/reports/tenantcost.py | 6 +++++- myems-api/reports/tenantenergycategory.py | 6 +++++- myems-api/reports/tenantenergyitem.py | 6 +++++- myems-api/reports/tenantload.py | 6 +++++- myems-api/reports/tenantsaving.py | 10 +++++++++- myems-api/reports/tenantstatistics.py | 6 +++++- myems-api/reports/virtualmetercost.py | 6 +++++- myems-api/reports/virtualmeterenergy.py | 6 +++++- 53 files changed, 306 insertions(+), 52 deletions(-) diff --git a/myems-api/reports/combinedequipmentcost.py b/myems-api/reports/combinedequipmentcost.py index b2562c7e..7d6f74ac 100644 --- a/myems-api/reports/combinedequipmentcost.py +++ b/myems-api/reports/combinedequipmentcost.py @@ -60,7 +60,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -286,6 +286,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -337,6 +339,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/combinedequipmentefficiency.py b/myems-api/reports/combinedequipmentefficiency.py index afaf9a08..49b2a832 100644 --- a/myems-api/reports/combinedequipmentefficiency.py +++ b/myems-api/reports/combinedequipmentefficiency.py @@ -60,7 +60,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -436,6 +436,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -455,6 +457,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -573,6 +577,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -592,6 +598,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/combinedequipmentenergycategory.py b/myems-api/reports/combinedequipmentenergycategory.py index c2886cf1..c06eb07e 100644 --- a/myems-api/reports/combinedequipmentenergycategory.py +++ b/myems-api/reports/combinedequipmentenergycategory.py @@ -60,7 +60,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -291,6 +291,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -349,6 +351,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/combinedequipmentenergyitem.py b/myems-api/reports/combinedequipmentenergyitem.py index 863b6c07..1ce17c22 100644 --- a/myems-api/reports/combinedequipmentenergyitem.py +++ b/myems-api/reports/combinedequipmentenergyitem.py @@ -60,7 +60,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -290,6 +290,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -341,6 +343,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/combinedequipmentincome.py b/myems-api/reports/combinedequipmentincome.py index 004be5e5..d52133a4 100644 --- a/myems-api/reports/combinedequipmentincome.py +++ b/myems-api/reports/combinedequipmentincome.py @@ -60,7 +60,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -286,6 +286,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -333,6 +335,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/combinedequipmentload.py b/myems-api/reports/combinedequipmentload.py index d18897f6..16659100 100644 --- a/myems-api/reports/combinedequipmentload.py +++ b/myems-api/reports/combinedequipmentload.py @@ -60,7 +60,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -298,6 +298,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -355,6 +357,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/combinedequipmentoutput.py b/myems-api/reports/combinedequipmentoutput.py index 1e5be77a..eb438d6a 100644 --- a/myems-api/reports/combinedequipmentoutput.py +++ b/myems-api/reports/combinedequipmentoutput.py @@ -60,7 +60,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -286,6 +286,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -333,6 +335,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/combinedequipmentsaving.py b/myems-api/reports/combinedequipmentsaving.py index febb3815..52ab71c6 100644 --- a/myems-api/reports/combinedequipmentsaving.py +++ b/myems-api/reports/combinedequipmentsaving.py @@ -60,7 +60,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -312,6 +312,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -351,6 +353,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -427,6 +431,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -466,6 +472,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/combinedequipmentstatistics.py b/myems-api/reports/combinedequipmentstatistics.py index 531a1c4b..3fd366ad 100644 --- a/myems-api/reports/combinedequipmentstatistics.py +++ b/myems-api/reports/combinedequipmentstatistics.py @@ -60,7 +60,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -299,6 +299,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -359,6 +361,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/dashboard.py b/myems-api/reports/dashboard.py index 0b03d626..f75fde71 100644 --- a/myems-api/reports/dashboard.py +++ b/myems-api/reports/dashboard.py @@ -54,7 +54,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -312,6 +312,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -359,6 +361,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -413,6 +417,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -480,6 +486,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/equipmentcost.py b/myems-api/reports/equipmentcost.py index 26706313..2f606913 100644 --- a/myems-api/reports/equipmentcost.py +++ b/myems-api/reports/equipmentcost.py @@ -54,7 +54,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -264,6 +264,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -314,6 +316,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/equipmentefficiency.py b/myems-api/reports/equipmentefficiency.py index ce882a25..64baabd6 100644 --- a/myems-api/reports/equipmentefficiency.py +++ b/myems-api/reports/equipmentefficiency.py @@ -54,7 +54,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -350,6 +350,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -369,6 +371,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -487,6 +491,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -506,6 +512,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/equipmentenergycategory.py b/myems-api/reports/equipmentenergycategory.py index 331a0466..7f063db8 100644 --- a/myems-api/reports/equipmentenergycategory.py +++ b/myems-api/reports/equipmentenergycategory.py @@ -54,7 +54,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -269,6 +269,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -326,6 +328,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/equipmentenergyitem.py b/myems-api/reports/equipmentenergyitem.py index 3ed11fbb..1ba96618 100644 --- a/myems-api/reports/equipmentenergyitem.py +++ b/myems-api/reports/equipmentenergyitem.py @@ -54,7 +54,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -268,6 +268,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -318,6 +320,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/equipmentincome.py b/myems-api/reports/equipmentincome.py index 8c9efb77..d08fd615 100644 --- a/myems-api/reports/equipmentincome.py +++ b/myems-api/reports/equipmentincome.py @@ -54,7 +54,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -264,6 +264,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -310,6 +312,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/equipmentload.py b/myems-api/reports/equipmentload.py index f14ce0e2..7c701228 100644 --- a/myems-api/reports/equipmentload.py +++ b/myems-api/reports/equipmentload.py @@ -54,7 +54,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -277,6 +277,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -334,6 +336,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/equipmentoutput.py b/myems-api/reports/equipmentoutput.py index c6789fdf..e4a2fcfe 100644 --- a/myems-api/reports/equipmentoutput.py +++ b/myems-api/reports/equipmentoutput.py @@ -54,7 +54,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -264,6 +264,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -310,6 +312,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/equipmentsaving.py b/myems-api/reports/equipmentsaving.py index bf3cc013..d8f8d1f6 100644 --- a/myems-api/reports/equipmentsaving.py +++ b/myems-api/reports/equipmentsaving.py @@ -54,7 +54,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -290,6 +290,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -328,6 +330,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -403,6 +407,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -441,6 +447,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/equipmentstatistics.py b/myems-api/reports/equipmentstatistics.py index 214ac8ae..830f7c5e 100644 --- a/myems-api/reports/equipmentstatistics.py +++ b/myems-api/reports/equipmentstatistics.py @@ -54,7 +54,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -278,6 +278,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -338,6 +340,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/metercost.py b/myems-api/reports/metercost.py index 4a528e57..318e51fa 100644 --- a/myems-api/reports/metercost.py +++ b/myems-api/reports/metercost.py @@ -59,7 +59,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -220,6 +220,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -287,6 +289,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/metersubmetersbalance.py b/myems-api/reports/metersubmetersbalance.py index e575cfe8..944fefa9 100644 --- a/myems-api/reports/metersubmetersbalance.py +++ b/myems-api/reports/metersubmetersbalance.py @@ -51,7 +51,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -183,6 +183,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -225,6 +227,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -284,6 +288,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/offlinemetercost.py b/myems-api/reports/offlinemetercost.py index deac662c..83c8fca8 100644 --- a/myems-api/reports/offlinemetercost.py +++ b/myems-api/reports/offlinemetercost.py @@ -57,7 +57,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -198,6 +198,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -265,6 +267,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/offlinemeterenergy.py b/myems-api/reports/offlinemeterenergy.py index 8db9ad16..d2b3dd26 100644 --- a/myems-api/reports/offlinemeterenergy.py +++ b/myems-api/reports/offlinemeterenergy.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -185,6 +185,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -228,6 +230,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/shopfloorcost.py b/myems-api/reports/shopfloorcost.py index be6355d5..77914495 100644 --- a/myems-api/reports/shopfloorcost.py +++ b/myems-api/reports/shopfloorcost.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -279,6 +279,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -329,6 +331,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/shopfloorenergycategory.py b/myems-api/reports/shopfloorenergycategory.py index 279c6412..5043654f 100644 --- a/myems-api/reports/shopfloorenergycategory.py +++ b/myems-api/reports/shopfloorenergycategory.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -284,6 +284,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -341,6 +343,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/shopfloorenergyitem.py b/myems-api/reports/shopfloorenergyitem.py index 7a77eab3..1a011f46 100644 --- a/myems-api/reports/shopfloorenergyitem.py +++ b/myems-api/reports/shopfloorenergyitem.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -283,6 +283,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -333,6 +335,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/shopfloorload.py b/myems-api/reports/shopfloorload.py index cdee1aba..591a1e94 100644 --- a/myems-api/reports/shopfloorload.py +++ b/myems-api/reports/shopfloorload.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -292,6 +292,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -349,6 +351,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/shopfloorsaving.py b/myems-api/reports/shopfloorsaving.py index 9a97a4f1..9ea673cf 100644 --- a/myems-api/reports/shopfloorsaving.py +++ b/myems-api/reports/shopfloorsaving.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -305,6 +305,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -343,6 +345,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -418,6 +422,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -456,6 +462,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/shopfloorstatistics.py b/myems-api/reports/shopfloorstatistics.py index 30dc1957..0fbd706d 100644 --- a/myems-api/reports/shopfloorstatistics.py +++ b/myems-api/reports/shopfloorstatistics.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -293,6 +293,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -353,6 +355,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/spacecost.py b/myems-api/reports/spacecost.py index 44239857..1fcb9b52 100644 --- a/myems-api/reports/spacecost.py +++ b/myems-api/reports/spacecost.py @@ -57,7 +57,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -294,6 +294,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -343,6 +345,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/spaceefficiency.py b/myems-api/reports/spaceefficiency.py index 7b95cf39..b3215c26 100644 --- a/myems-api/reports/spaceefficiency.py +++ b/myems-api/reports/spaceefficiency.py @@ -57,7 +57,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -307,6 +307,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -352,6 +354,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -397,6 +401,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -443,6 +449,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/spaceenergycategory.py b/myems-api/reports/spaceenergycategory.py index f2961888..b005436f 100644 --- a/myems-api/reports/spaceenergycategory.py +++ b/myems-api/reports/spaceenergycategory.py @@ -57,7 +57,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -299,6 +299,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -355,6 +357,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/spaceenergyitem.py b/myems-api/reports/spaceenergyitem.py index c53c554b..3762105f 100644 --- a/myems-api/reports/spaceenergyitem.py +++ b/myems-api/reports/spaceenergyitem.py @@ -57,7 +57,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -298,6 +298,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -347,6 +349,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/spaceincome.py b/myems-api/reports/spaceincome.py index bf56b4ab..87803b62 100644 --- a/myems-api/reports/spaceincome.py +++ b/myems-api/reports/spaceincome.py @@ -57,7 +57,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -294,6 +294,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -339,6 +341,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/spaceload.py b/myems-api/reports/spaceload.py index 9d5aafd1..bb0e8570 100644 --- a/myems-api/reports/spaceload.py +++ b/myems-api/reports/spaceload.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -292,6 +292,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -349,6 +351,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/spaceoutput.py b/myems-api/reports/spaceoutput.py index 3081ed77..39f95a03 100644 --- a/myems-api/reports/spaceoutput.py +++ b/myems-api/reports/spaceoutput.py @@ -57,7 +57,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -294,6 +294,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -339,6 +341,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/spacesaving.py b/myems-api/reports/spacesaving.py index 0bb185bb..c3a5bf0e 100644 --- a/myems-api/reports/spacesaving.py +++ b/myems-api/reports/spacesaving.py @@ -57,7 +57,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -320,6 +320,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -357,6 +359,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -431,6 +435,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -468,6 +474,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/spacestatistics.py b/myems-api/reports/spacestatistics.py index 90aa5fdb..a615eaf7 100644 --- a/myems-api/reports/spacestatistics.py +++ b/myems-api/reports/spacestatistics.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -293,6 +293,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -352,6 +354,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/storecost.py b/myems-api/reports/storecost.py index 1f03ab2b..04b17e96 100644 --- a/myems-api/reports/storecost.py +++ b/myems-api/reports/storecost.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -279,6 +279,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -328,6 +330,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/storeenergycategory.py b/myems-api/reports/storeenergycategory.py index aacbcf81..9326a0e9 100644 --- a/myems-api/reports/storeenergycategory.py +++ b/myems-api/reports/storeenergycategory.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -284,6 +284,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -340,6 +342,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/storeenergyitem.py b/myems-api/reports/storeenergyitem.py index 69b9dc68..e8bded63 100644 --- a/myems-api/reports/storeenergyitem.py +++ b/myems-api/reports/storeenergyitem.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -283,6 +283,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -332,6 +334,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/storeload.py b/myems-api/reports/storeload.py index 1be7f6d4..364d7d20 100644 --- a/myems-api/reports/storeload.py +++ b/myems-api/reports/storeload.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -292,6 +292,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -349,6 +351,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/storesaving.py b/myems-api/reports/storesaving.py index 7c22f648..be1af2be 100644 --- a/myems-api/reports/storesaving.py +++ b/myems-api/reports/storesaving.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -305,6 +305,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -342,6 +344,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -416,6 +420,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -453,6 +459,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/storestatistics.py b/myems-api/reports/storestatistics.py index ef782eb3..1ef536e5 100644 --- a/myems-api/reports/storestatistics.py +++ b/myems-api/reports/storestatistics.py @@ -56,7 +56,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -294,6 +294,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -353,6 +355,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/tenantbill.py b/myems-api/reports/tenantbill.py index a6381da6..a748ecce 100644 --- a/myems-api/reports/tenantbill.py +++ b/myems-api/reports/tenantbill.py @@ -211,6 +211,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -256,6 +258,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/tenantcost.py b/myems-api/reports/tenantcost.py index 3ea1f4f6..add30dad 100644 --- a/myems-api/reports/tenantcost.py +++ b/myems-api/reports/tenantcost.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -279,6 +279,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -328,6 +330,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/tenantenergycategory.py b/myems-api/reports/tenantenergycategory.py index 3d268806..9c7858d0 100644 --- a/myems-api/reports/tenantenergycategory.py +++ b/myems-api/reports/tenantenergycategory.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -284,6 +284,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -340,6 +342,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/tenantenergyitem.py b/myems-api/reports/tenantenergyitem.py index fab9a0bf..ea20590c 100644 --- a/myems-api/reports/tenantenergyitem.py +++ b/myems-api/reports/tenantenergyitem.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -283,6 +283,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -332,6 +334,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/tenantload.py b/myems-api/reports/tenantload.py index fa6fe848..1287714b 100644 --- a/myems-api/reports/tenantload.py +++ b/myems-api/reports/tenantload.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -292,6 +292,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -349,6 +351,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/tenantsaving.py b/myems-api/reports/tenantsaving.py index 103ea9c6..d9ed4d88 100644 --- a/myems-api/reports/tenantsaving.py +++ b/myems-api/reports/tenantsaving.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -305,6 +305,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -342,6 +344,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -416,6 +420,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -453,6 +459,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/tenantstatistics.py b/myems-api/reports/tenantstatistics.py index 49a4224d..f4e38112 100644 --- a/myems-api/reports/tenantstatistics.py +++ b/myems-api/reports/tenantstatistics.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -293,6 +293,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -352,6 +354,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/virtualmetercost.py b/myems-api/reports/virtualmetercost.py index e8bc8a5a..e6eae2df 100644 --- a/myems-api/reports/virtualmetercost.py +++ b/myems-api/reports/virtualmetercost.py @@ -57,7 +57,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -197,6 +197,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -264,6 +266,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': diff --git a/myems-api/reports/virtualmeterenergy.py b/myems-api/reports/virtualmeterenergy.py index c3c0dec7..962749c7 100644 --- a/myems-api/reports/virtualmeterenergy.py +++ b/myems-api/reports/virtualmeterenergy.py @@ -55,7 +55,7 @@ class Reporting: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') else: period_type = str.strip(period_type) - if period_type not in ['hourly', 'daily', 'monthly', 'yearly']: + if period_type not in ['hourly', 'daily', 'weekly', 'monthly', 'yearly']: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_PERIOD_TYPE') timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6]) @@ -188,6 +188,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': @@ -231,6 +233,8 @@ class Reporting: current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S') elif period_type == 'daily': current_datetime = current_datetime_local.strftime('%Y-%m-%d') + elif period_type == 'weekly': + current_datetime = current_datetime_local.strftime('%Y-%m-%d') elif period_type == 'monthly': current_datetime = current_datetime_local.strftime('%Y-%m') elif period_type == 'yearly': From 3fc620b596029f81ceaa868f05bcc4b3fa3138ae Mon Sep 17 00:00:00 2001 From: Caozhenhui <823914102@qq.com> Date: Wed, 3 Nov 2021 10:32:16 +0800 Subject: [PATCH 03/10] Added the time scale of weekly --- myems-api/core/utilities.py | 1 - 1 file changed, 1 deletion(-) diff --git a/myems-api/core/utilities.py b/myems-api/core/utilities.py index 01305856..0d91c3b4 100644 --- a/myems-api/core/utilities.py +++ b/myems-api/core/utilities.py @@ -71,7 +71,6 @@ def aggregate_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetim while current_datetime_utc <= end_datetime_utc: next_datetime_utc = current_datetime_utc + timedelta(days=7) - subtotal = Decimal(0.0) for row in rows_hourly: if current_datetime_utc <= row[0] < next_datetime_utc: From 4a44727a0ab162cd4de30b7339894581c23c2929 Mon Sep 17 00:00:00 2001 From: Caozhenhui <823914102@qq.com> Date: Wed, 3 Nov 2021 11:00:17 +0800 Subject: [PATCH 04/10] Added the time scale of weekly --- myems-api/core/utilities.py | 43 ++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/myems-api/core/utilities.py b/myems-api/core/utilities.py index 0d91c3b4..4c6bb108 100644 --- a/myems-api/core/utilities.py +++ b/myems-api/core/utilities.py @@ -412,7 +412,7 @@ def averaging_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetim if start_datetime_utc is None or \ end_datetime_utc is None or \ start_datetime_utc >= end_datetime_utc or \ - period_type not in ('hourly', 'daily', 'monthly', 'yearly'): + period_type not in ('hourly', 'daily', 'weekly', 'monthly', 'yearly'): return list(), None, None start_datetime_utc = start_datetime_utc.replace(tzinfo=None) @@ -495,6 +495,47 @@ def averaging_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetim average = total / counter if counter > 0 else None return result_rows_daily, average, maximum + elif period_type == 'weekly': + result_rows_weekly = list() + # todo: add config.working_day_start_time_local + # todo: add config.minutes_to_count + total = Decimal(0.0) + maximum = None + counter = 0 + # calculate the start datetime in utc of the monday in the first week in local + start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3])) + weekday = start_datetime_local.weekday() + current_datetime_utc = \ + start_datetime_local.replace(hour=0) - timedelta(days=weekday, hours=int(config.utc_offset[1:3])) + while current_datetime_utc <= end_datetime_utc: + while current_datetime_utc <= end_datetime_utc: + sub_total = Decimal(0.0) + sub_maximum = None + sub_counter = 0 + for row in rows_hourly: + if current_datetime_utc <= row[0] < current_datetime_utc + timedelta(days=7): + sub_total += row[1] + if sub_maximum is None: + sub_maximum = row[1] + elif sub_maximum < row[1]: + sub_maximum = row[1] + sub_counter += 1 + + sub_average = (sub_total / sub_counter) if sub_counter > 0 else None + result_rows_weekly.append((current_datetime_utc, sub_average, sub_maximum)) + total += sub_total + counter += sub_counter + if sub_maximum is None: + pass + elif maximum is None: + maximum = sub_maximum + elif maximum < sub_maximum: + maximum = sub_maximum + current_datetime_utc += timedelta(days=7) + + average = total / counter if counter > 0 else None + return result_rows_weekly, average, maximum + elif period_type == "monthly": result_rows_monthly = list() # todo: add config.working_day_start_time_local From 88e33fa9c68a407798b4a3abaad8dc4088fb1878 Mon Sep 17 00:00:00 2001 From: Caozhenhui <823914102@qq.com> Date: Wed, 3 Nov 2021 11:09:48 +0800 Subject: [PATCH 05/10] Added the time scale of weekly --- myems-api/core/utilities.py | 49 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/myems-api/core/utilities.py b/myems-api/core/utilities.py index 4c6bb108..d1962afd 100644 --- a/myems-api/core/utilities.py +++ b/myems-api/core/utilities.py @@ -508,33 +508,32 @@ def averaging_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetim current_datetime_utc = \ start_datetime_local.replace(hour=0) - timedelta(days=weekday, hours=int(config.utc_offset[1:3])) while current_datetime_utc <= end_datetime_utc: - while current_datetime_utc <= end_datetime_utc: - sub_total = Decimal(0.0) - sub_maximum = None - sub_counter = 0 - for row in rows_hourly: - if current_datetime_utc <= row[0] < current_datetime_utc + timedelta(days=7): - sub_total += row[1] - if sub_maximum is None: - sub_maximum = row[1] - elif sub_maximum < row[1]: - sub_maximum = row[1] - sub_counter += 1 + sub_total = Decimal(0.0) + sub_maximum = None + sub_counter = 0 + for row in rows_hourly: + if current_datetime_utc <= row[0] < current_datetime_utc + timedelta(days=7): + sub_total += row[1] + if sub_maximum is None: + sub_maximum = row[1] + elif sub_maximum < row[1]: + sub_maximum = row[1] + sub_counter += 1 - sub_average = (sub_total / sub_counter) if sub_counter > 0 else None - result_rows_weekly.append((current_datetime_utc, sub_average, sub_maximum)) - total += sub_total - counter += sub_counter - if sub_maximum is None: - pass - elif maximum is None: - maximum = sub_maximum - elif maximum < sub_maximum: - maximum = sub_maximum - current_datetime_utc += timedelta(days=7) + sub_average = (sub_total / sub_counter) if sub_counter > 0 else None + result_rows_weekly.append((current_datetime_utc, sub_average, sub_maximum)) + total += sub_total + counter += sub_counter + if sub_maximum is None: + pass + elif maximum is None: + maximum = sub_maximum + elif maximum < sub_maximum: + maximum = sub_maximum + current_datetime_utc += timedelta(days=7) - average = total / counter if counter > 0 else None - return result_rows_weekly, average, maximum + average = total / counter if counter > 0 else None + return result_rows_weekly, average, maximum elif period_type == "monthly": result_rows_monthly = list() From caa65ef13649fbfe8e8005374dfbf09fe83a326f Mon Sep 17 00:00:00 2001 From: Caozhenhui <823914102@qq.com> Date: Thu, 4 Nov 2021 16:24:23 +0800 Subject: [PATCH 06/10] Added the time scale of weekly in statistics_hourly_data_by_period --- myems-api/core/utilities.py | 46 ++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/myems-api/core/utilities.py b/myems-api/core/utilities.py index d1962afd..7020a577 100644 --- a/myems-api/core/utilities.py +++ b/myems-api/core/utilities.py @@ -701,7 +701,7 @@ def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_dateti if start_datetime_utc is None or \ end_datetime_utc is None or \ start_datetime_utc >= end_datetime_utc or \ - period_type not in ('hourly', 'daily', 'monthly', 'yearly'): + period_type not in ('hourly', 'daily', 'weekly', 'monthly', 'yearly'): return list(), None, None, None, None, None, None start_datetime_utc = start_datetime_utc.replace(tzinfo=None) @@ -795,6 +795,50 @@ def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_dateti return result_rows_daily, mean, median, minimum, maximum, stdev, variance + elif period_type == "weekly": + result_rows_daily = list() + sample_data = list() + # todo: add config.working_day_start_time_local + # todo: add config.minutes_to_count + counter = 0 + mean = None + median = None + minimum = None + maximum = None + stdev = None + variance = None + # calculate the start datetime in utc of the monday in the first week in local + start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3])) + current_datetime_utc = start_datetime_local.replace(hour=0) - timedelta(hours=int(config.utc_offset[1:3])) + while current_datetime_utc <= end_datetime_utc: + sub_total = Decimal(0.0) + for row in rows_hourly: + if current_datetime_utc <= row[0] < current_datetime_utc + timedelta(days=7): + sub_total += row[1] + + result_rows_daily.append((current_datetime_utc, sub_total)) + sample_data.append(sub_total) + + counter += 1 + if minimum is None: + minimum = sub_total + elif minimum > sub_total: + minimum = sub_total + + if maximum is None: + maximum = sub_total + elif maximum < sub_total: + maximum = sub_total + current_datetime_utc += timedelta(days=7) + + if len(sample_data) > 1: + mean = statistics.mean(sample_data) + median = statistics.median(sample_data) + stdev = statistics.stdev(sample_data) + variance = statistics.variance(sample_data) + + return result_rows_daily, mean, median, minimum, maximum, stdev, variance + elif period_type == "monthly": result_rows_monthly = list() sample_data = list() From 67f22d2dd3889002b069326ced5abc1b36fb78d5 Mon Sep 17 00:00:00 2001 From: Caozhenhui <823914102@qq.com> Date: Thu, 4 Nov 2021 19:49:23 +0800 Subject: [PATCH 07/10] Modified the current_datetime_utcvariable in the statistics_hourly_data_by_period method --- myems-api/core/utilities.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/myems-api/core/utilities.py b/myems-api/core/utilities.py index 7020a577..5930d544 100644 --- a/myems-api/core/utilities.py +++ b/myems-api/core/utilities.py @@ -765,7 +765,9 @@ def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_dateti variance = None # calculate the start datetime in utc of the first day in local start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3])) - current_datetime_utc = start_datetime_local.replace(hour=0) - timedelta(hours=int(config.utc_offset[1:3])) + weekday = start_datetime_local.weekday() + current_datetime_utc = \ + start_datetime_local.replace(hour=0) - timedelta(days=weekday, hours=int(config.utc_offset[1:3])) while current_datetime_utc <= end_datetime_utc: sub_total = Decimal(0.0) for row in rows_hourly: From bffef535ea8e36900b697d320f8338044ba4b011 Mon Sep 17 00:00:00 2001 From: Caozhenhui <823914102@qq.com> Date: Thu, 4 Nov 2021 19:50:44 +0800 Subject: [PATCH 08/10] Modified the current_datetime_utcvariable in the statistics_hourly_data_by_period method --- myems-api/core/utilities.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/myems-api/core/utilities.py b/myems-api/core/utilities.py index 5930d544..5a0a1d6f 100644 --- a/myems-api/core/utilities.py +++ b/myems-api/core/utilities.py @@ -765,9 +765,7 @@ def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_dateti variance = None # calculate the start datetime in utc of the first day in local start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3])) - weekday = start_datetime_local.weekday() - current_datetime_utc = \ - start_datetime_local.replace(hour=0) - timedelta(days=weekday, hours=int(config.utc_offset[1:3])) + current_datetime_utc = start_datetime_local.replace(hour=0) - timedelta(hours=int(config.utc_offset[1:3])) while current_datetime_utc <= end_datetime_utc: sub_total = Decimal(0.0) for row in rows_hourly: @@ -811,7 +809,9 @@ def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_dateti variance = None # calculate the start datetime in utc of the monday in the first week in local start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3])) - current_datetime_utc = start_datetime_local.replace(hour=0) - timedelta(hours=int(config.utc_offset[1:3])) + weekday = start_datetime_local.weekday() + current_datetime_utc = \ + start_datetime_local.replace(hour=0) - timedelta(days=weekday, hours=int(config.utc_offset[1:3])) while current_datetime_utc <= end_datetime_utc: sub_total = Decimal(0.0) for row in rows_hourly: From 2c748d2eee2a250f6f735204ac7ac1ce4a80d0ea Mon Sep 17 00:00:00 2001 From: Caozhenhui <823914102@qq.com> Date: Thu, 4 Nov 2021 20:24:51 +0800 Subject: [PATCH 09/10] Modified the current_datetime_utcvariable in the statistics_hourly_data_by_period method --- myems-api/core/utilities.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/myems-api/core/utilities.py b/myems-api/core/utilities.py index 5a0a1d6f..8cfa9e19 100644 --- a/myems-api/core/utilities.py +++ b/myems-api/core/utilities.py @@ -796,7 +796,7 @@ def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_dateti return result_rows_daily, mean, median, minimum, maximum, stdev, variance elif period_type == "weekly": - result_rows_daily = list() + result_rows_weekly = list() sample_data = list() # todo: add config.working_day_start_time_local # todo: add config.minutes_to_count @@ -818,7 +818,7 @@ def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_dateti if current_datetime_utc <= row[0] < current_datetime_utc + timedelta(days=7): sub_total += row[1] - result_rows_daily.append((current_datetime_utc, sub_total)) + result_rows_weekly.append((current_datetime_utc, sub_total)) sample_data.append(sub_total) counter += 1 @@ -839,7 +839,7 @@ def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_dateti stdev = statistics.stdev(sample_data) variance = statistics.variance(sample_data) - return result_rows_daily, mean, median, minimum, maximum, stdev, variance + return result_rows_weekly, mean, median, minimum, maximum, stdev, variance elif period_type == "monthly": result_rows_monthly = list() From cfe749e44d136345cd30987b3797d1a03cbaf102 Mon Sep 17 00:00:00 2001 From: "13621160019@163.com" <13621160019@163.com> Date: Thu, 4 Nov 2021 21:18:50 +0800 Subject: [PATCH 10/10] added weekly to i18n of Web UI --- myems-api/core/utilities.py | 6 +++--- myems-api/reports/tenantbill.py | 2 +- web/src/i18n.js | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/myems-api/core/utilities.py b/myems-api/core/utilities.py index 8cfa9e19..edf55e4e 100644 --- a/myems-api/core/utilities.py +++ b/myems-api/core/utilities.py @@ -12,7 +12,7 @@ import statistics # rows_hourly: list of (start_datetime_utc, actual_value), should belong to one energy_category_id # start_datetime_utc: start datetime in utc # end_datetime_utc: end datetime in utc -# period_type: one of the following period types, 'hourly', 'daily', 'weekly', 'monthly' and 'yearly' +# period_type: use one of the period types, 'hourly', 'daily', 'weekly', 'monthly' and 'yearly' # Note: this procedure doesn't work with multiple energy categories ######################################################################################################################## def aggregate_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetime_utc, period_type): @@ -403,7 +403,7 @@ def get_energy_category_peak_types(cost_center_id, energy_category_id, start_dat # rows_hourly: list of (start_datetime_utc, actual_value), should belong to one energy_category_id # start_datetime_utc: start datetime in utc # end_datetime_utc: end datetime in utc -# period_type: one of the following period types, 'hourly', 'daily', 'monthly' and 'yearly' +# period_type: use one of the period types, 'hourly', 'daily', 'weekly', 'monthly' and 'yearly' # Returns: periodically data of average and maximum # Note: this procedure doesn't work with multiple energy categories ######################################################################################################################## @@ -692,7 +692,7 @@ def averaging_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetim # rows_hourly: list of (start_datetime_utc, actual_value), should belong to one energy_category_id # start_datetime_utc: start datetime in utc # end_datetime_utc: end datetime in utc -# period_type: one of the following period types, 'hourly', 'daily', 'monthly' and 'yearly' +# period_type: use one of the period types, 'hourly', 'daily', 'weekly', 'monthly' and 'yearly' # Returns: periodically data of values and statistics of mean, median, minimum, maximum, stdev and variance # Note: this procedure doesn't work with multiple energy categories ######################################################################################################################## diff --git a/myems-api/reports/tenantbill.py b/myems-api/reports/tenantbill.py index a748ecce..c5320de8 100644 --- a/myems-api/reports/tenantbill.py +++ b/myems-api/reports/tenantbill.py @@ -34,7 +34,7 @@ class Reporting: tenant_id = req.params.get('tenantid') reporting_start_datetime_local = req.params.get('reportingperiodstartdatetime') reporting_end_datetime_local = req.params.get('reportingperiodenddatetime') - + # This value is intentionally left daily period_type = 'daily' ################################################################################################################ diff --git a/web/src/i18n.js b/web/src/i18n.js index 35ac6409..e8f0b1ff 100644 --- a/web/src/i18n.js +++ b/web/src/i18n.js @@ -122,6 +122,7 @@ const resources = { "Period Types": "Period Types", "Yearly": "Yearly", "Monthly": "Monthly", + "Weekly": "Weekly", "Daily": "Daily", "Hourly": "Hourly", "Submit": "Submit", @@ -867,6 +868,7 @@ const resources = { "Period Types": "Periodentypen", "Yearly": "Jährlich", "Monthly": "Monatlich", + "Weekly": "Wöchentlich", "Daily": "Täglich", "Hourly": "Stündlich", "Submit": "einreichen",