From f870e8b483d72cc2ab466f8dd77d9ba1f6a6a83a Mon Sep 17 00:00:00 2001 From: "13621160019@163.com" <13621160019@163.com> Date: Sat, 13 Mar 2021 09:19:33 +0800 Subject: [PATCH] fixed issues of historcial database close and disconnect in api --- myems-api/reports/combinedequipmentcost.py | 18 +++++++++--------- .../reports/combinedequipmentefficiency.py | 6 +++--- .../reports/combinedequipmentenergycategory.py | 18 +++++++++--------- .../reports/combinedequipmentenergyitem.py | 18 +++++++++--------- myems-api/reports/combinedequipmentincome.py | 18 +++++++++--------- myems-api/reports/combinedequipmentload.py | 18 +++++++++--------- myems-api/reports/combinedequipmentoutput.py | 18 +++++++++--------- myems-api/reports/combinedequipmentsaving.py | 18 +++++++++--------- .../reports/combinedequipmentstatistics.py | 18 +++++++++--------- myems-api/reports/equipmentcost.py | 18 +++++++++--------- myems-api/reports/equipmentefficiency.py | 6 +++--- myems-api/reports/equipmentenergycategory.py | 18 +++++++++--------- myems-api/reports/equipmentenergyitem.py | 18 +++++++++--------- myems-api/reports/equipmentincome.py | 18 +++++++++--------- myems-api/reports/equipmentload.py | 18 +++++++++--------- myems-api/reports/equipmentoutput.py | 18 +++++++++--------- myems-api/reports/equipmentsaving.py | 18 +++++++++--------- myems-api/reports/equipmentstatistics.py | 18 +++++++++--------- myems-api/reports/shopfloorcost.py | 18 +++++++++--------- myems-api/reports/shopfloorenergycategory.py | 18 +++++++++--------- myems-api/reports/shopfloorenergyitem.py | 18 +++++++++--------- myems-api/reports/shopfloorload.py | 18 +++++++++--------- myems-api/reports/shopfloorsaving.py | 18 +++++++++--------- myems-api/reports/shopfloorstatistics.py | 18 +++++++++--------- myems-api/reports/spacecost.py | 18 +++++++++--------- myems-api/reports/spaceefficiency.py | 18 +++++++++--------- myems-api/reports/spaceenergycategory.py | 18 +++++++++--------- myems-api/reports/spaceenergyitem.py | 18 +++++++++--------- myems-api/reports/spaceincome.py | 18 +++++++++--------- myems-api/reports/spaceload.py | 18 +++++++++--------- myems-api/reports/spaceoutput.py | 18 +++++++++--------- myems-api/reports/spacesaving.py | 18 +++++++++--------- myems-api/reports/spacestatistics.py | 18 +++++++++--------- myems-api/reports/storecost.py | 18 +++++++++--------- myems-api/reports/storeenergycategory.py | 18 +++++++++--------- myems-api/reports/storeenergyitem.py | 18 +++++++++--------- myems-api/reports/storeload.py | 18 +++++++++--------- myems-api/reports/storesaving.py | 18 +++++++++--------- myems-api/reports/storestatistics.py | 18 +++++++++--------- myems-api/reports/tenantcost.py | 18 +++++++++--------- myems-api/reports/tenantenergycategory.py | 18 +++++++++--------- myems-api/reports/tenantenergyitem.py | 18 +++++++++--------- myems-api/reports/tenantload.py | 18 +++++++++--------- myems-api/reports/tenantsaving.py | 18 +++++++++--------- myems-api/reports/tenantstatistics.py | 18 +++++++++--------- myems-api/reports/virtualmetercost.py | 5 ----- myems-api/reports/virtualmeterenergy.py | 6 +++--- 47 files changed, 396 insertions(+), 401 deletions(-) diff --git a/myems-api/reports/combinedequipmentcost.py b/myems-api/reports/combinedequipmentcost.py index 7eb3727f..1da3e452 100644 --- a/myems-api/reports/combinedequipmentcost.py +++ b/myems-api/reports/combinedequipmentcost.py @@ -148,10 +148,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.COMBINED_EQUIPMENT_NOT_FOUND') @@ -205,10 +205,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -452,10 +452,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/combinedequipmentefficiency.py b/myems-api/reports/combinedequipmentefficiency.py index 073c67bc..fff1f5f1 100644 --- a/myems-api/reports/combinedequipmentefficiency.py +++ b/myems-api/reports/combinedequipmentefficiency.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.COMBINED_EQUIPMENT_NOT_FOUND') diff --git a/myems-api/reports/combinedequipmentenergycategory.py b/myems-api/reports/combinedequipmentenergycategory.py index 3261d871..0bc905d4 100644 --- a/myems-api/reports/combinedequipmentenergycategory.py +++ b/myems-api/reports/combinedequipmentenergycategory.py @@ -148,10 +148,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.COMBINED_EQUIPMENT_NOT_FOUND') @@ -205,10 +205,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -466,10 +466,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/combinedequipmentenergyitem.py b/myems-api/reports/combinedequipmentenergyitem.py index a7906240..ced3add1 100644 --- a/myems-api/reports/combinedequipmentenergyitem.py +++ b/myems-api/reports/combinedequipmentenergyitem.py @@ -148,10 +148,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.COMBINED_EQUIPMENT_NOT_FOUND') @@ -207,10 +207,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_ITEM_NOT_FOUND') @@ -456,10 +456,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/combinedequipmentincome.py b/myems-api/reports/combinedequipmentincome.py index e32558e4..af64fc8d 100644 --- a/myems-api/reports/combinedequipmentincome.py +++ b/myems-api/reports/combinedequipmentincome.py @@ -148,10 +148,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.COMBINED_EQUIPMENT_NOT_FOUND') @@ -205,10 +205,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -432,10 +432,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/combinedequipmentload.py b/myems-api/reports/combinedequipmentload.py index 5b60c584..0751dc6e 100644 --- a/myems-api/reports/combinedequipmentload.py +++ b/myems-api/reports/combinedequipmentload.py @@ -148,10 +148,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.COMBINED_EQUIPMENT_NOT_FOUND') @@ -205,10 +205,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -452,10 +452,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/combinedequipmentoutput.py b/myems-api/reports/combinedequipmentoutput.py index a3810a36..28aeb015 100644 --- a/myems-api/reports/combinedequipmentoutput.py +++ b/myems-api/reports/combinedequipmentoutput.py @@ -148,10 +148,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.COMBINED_EQUIPMENT_NOT_FOUND') @@ -205,10 +205,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -432,10 +432,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/combinedequipmentsaving.py b/myems-api/reports/combinedequipmentsaving.py index 75ae7755..b55dbcbc 100644 --- a/myems-api/reports/combinedequipmentsaving.py +++ b/myems-api/reports/combinedequipmentsaving.py @@ -156,10 +156,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.COMBINED_EQUIPMENT_NOT_FOUND') @@ -218,10 +218,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -586,10 +586,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/combinedequipmentstatistics.py b/myems-api/reports/combinedequipmentstatistics.py index 14e2327b..5e9b579c 100644 --- a/myems-api/reports/combinedequipmentstatistics.py +++ b/myems-api/reports/combinedequipmentstatistics.py @@ -148,10 +148,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.COMBINED_EQUIPMENT_NOT_FOUND') @@ -205,10 +205,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -458,10 +458,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/equipmentcost.py b/myems-api/reports/equipmentcost.py index 4c45e257..ed96fea5 100644 --- a/myems-api/reports/equipmentcost.py +++ b/myems-api/reports/equipmentcost.py @@ -143,10 +143,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND') equipment = dict() @@ -198,10 +198,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -441,10 +441,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/equipmentefficiency.py b/myems-api/reports/equipmentefficiency.py index e1fd2689..54f2b961 100644 --- a/myems-api/reports/equipmentefficiency.py +++ b/myems-api/reports/equipmentefficiency.py @@ -143,10 +143,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND') equipment = dict() diff --git a/myems-api/reports/equipmentenergycategory.py b/myems-api/reports/equipmentenergycategory.py index 97fc48e4..fd490d3b 100644 --- a/myems-api/reports/equipmentenergycategory.py +++ b/myems-api/reports/equipmentenergycategory.py @@ -144,10 +144,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND') equipment = dict() @@ -199,10 +199,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -456,10 +456,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/equipmentenergyitem.py b/myems-api/reports/equipmentenergyitem.py index 6026aa34..20fb744c 100644 --- a/myems-api/reports/equipmentenergyitem.py +++ b/myems-api/reports/equipmentenergyitem.py @@ -144,10 +144,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND') equipment = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_ITEM_NOT_FOUND') @@ -448,10 +448,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/equipmentincome.py b/myems-api/reports/equipmentincome.py index 8d3aa28e..55ae0fff 100644 --- a/myems-api/reports/equipmentincome.py +++ b/myems-api/reports/equipmentincome.py @@ -144,10 +144,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND') equipment = dict() @@ -199,10 +199,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -423,10 +423,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/equipmentload.py b/myems-api/reports/equipmentload.py index 5de6ae5e..71091a23 100644 --- a/myems-api/reports/equipmentload.py +++ b/myems-api/reports/equipmentload.py @@ -144,10 +144,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND') equipment = dict() @@ -199,10 +199,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -445,10 +445,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/equipmentoutput.py b/myems-api/reports/equipmentoutput.py index 83be9d86..92680c82 100644 --- a/myems-api/reports/equipmentoutput.py +++ b/myems-api/reports/equipmentoutput.py @@ -144,10 +144,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND') equipment = dict() @@ -199,10 +199,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -423,10 +423,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/equipmentsaving.py b/myems-api/reports/equipmentsaving.py index 3adf8c95..797e7794 100644 --- a/myems-api/reports/equipmentsaving.py +++ b/myems-api/reports/equipmentsaving.py @@ -152,10 +152,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND') equipment = dict() @@ -212,10 +212,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -575,10 +575,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/equipmentstatistics.py b/myems-api/reports/equipmentstatistics.py index 02e65b5e..b4aff44d 100644 --- a/myems-api/reports/equipmentstatistics.py +++ b/myems-api/reports/equipmentstatistics.py @@ -144,10 +144,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND') equipment = dict() @@ -199,10 +199,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -451,10 +451,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/shopfloorcost.py b/myems-api/reports/shopfloorcost.py index 3a2f668d..6a618690 100644 --- a/myems-api/reports/shopfloorcost.py +++ b/myems-api/reports/shopfloorcost.py @@ -145,10 +145,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND') shopfloor = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -457,10 +457,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/shopfloorenergycategory.py b/myems-api/reports/shopfloorenergycategory.py index 4f820cf9..ceff62bc 100644 --- a/myems-api/reports/shopfloorenergycategory.py +++ b/myems-api/reports/shopfloorenergycategory.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND') shopfloor = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -471,10 +471,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/shopfloorenergyitem.py b/myems-api/reports/shopfloorenergyitem.py index 073f4cb9..ed59f557 100644 --- a/myems-api/reports/shopfloorenergyitem.py +++ b/myems-api/reports/shopfloorenergyitem.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND') shopfloor = dict() @@ -203,10 +203,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_ITEM_NOT_FOUND') @@ -463,10 +463,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/shopfloorload.py b/myems-api/reports/shopfloorload.py index af7741c1..307b8777 100644 --- a/myems-api/reports/shopfloorload.py +++ b/myems-api/reports/shopfloorload.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND') shopfloor = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -460,10 +460,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/shopfloorsaving.py b/myems-api/reports/shopfloorsaving.py index 3089139e..86a89c0a 100644 --- a/myems-api/reports/shopfloorsaving.py +++ b/myems-api/reports/shopfloorsaving.py @@ -153,10 +153,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND') shopfloor = dict() @@ -214,10 +214,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -590,10 +590,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/shopfloorstatistics.py b/myems-api/reports/shopfloorstatistics.py index f470d72c..53f4839a 100644 --- a/myems-api/reports/shopfloorstatistics.py +++ b/myems-api/reports/shopfloorstatistics.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND') shopfloor = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -466,10 +466,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/spacecost.py b/myems-api/reports/spacecost.py index 506955f1..b3393e09 100644 --- a/myems-api/reports/spacecost.py +++ b/myems-api/reports/spacecost.py @@ -147,10 +147,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND') space = dict() @@ -203,10 +203,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -499,10 +499,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/spaceefficiency.py b/myems-api/reports/spaceefficiency.py index 5f7a4164..b39314e6 100644 --- a/myems-api/reports/spaceefficiency.py +++ b/myems-api/reports/spaceefficiency.py @@ -146,10 +146,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND') space = dict() @@ -227,10 +227,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -554,10 +554,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/spaceenergycategory.py b/myems-api/reports/spaceenergycategory.py index 7c8027df..d91a7d98 100644 --- a/myems-api/reports/spaceenergycategory.py +++ b/myems-api/reports/spaceenergycategory.py @@ -147,10 +147,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND') space = dict() @@ -203,10 +203,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -519,10 +519,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/spaceenergyitem.py b/myems-api/reports/spaceenergyitem.py index a15173fc..f8b2b7b6 100644 --- a/myems-api/reports/spaceenergyitem.py +++ b/myems-api/reports/spaceenergyitem.py @@ -147,10 +147,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND') space = dict() @@ -205,10 +205,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_ITEM_NOT_FOUND') @@ -506,10 +506,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/spaceincome.py b/myems-api/reports/spaceincome.py index 6b5c0679..83d0d0df 100644 --- a/myems-api/reports/spaceincome.py +++ b/myems-api/reports/spaceincome.py @@ -147,10 +147,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND') space = dict() @@ -203,10 +203,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -480,10 +480,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/spaceload.py b/myems-api/reports/spaceload.py index 7cb7fbb0..96bf3851 100644 --- a/myems-api/reports/spaceload.py +++ b/myems-api/reports/spaceload.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND') space = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -460,10 +460,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/spaceoutput.py b/myems-api/reports/spaceoutput.py index 24052555..0955b525 100644 --- a/myems-api/reports/spaceoutput.py +++ b/myems-api/reports/spaceoutput.py @@ -147,10 +147,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND') space = dict() @@ -203,10 +203,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -480,10 +480,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/spacesaving.py b/myems-api/reports/spacesaving.py index 55acb9f3..9f6dc75d 100644 --- a/myems-api/reports/spacesaving.py +++ b/myems-api/reports/spacesaving.py @@ -155,10 +155,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND') space = dict() @@ -216,10 +216,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -661,10 +661,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/spacestatistics.py b/myems-api/reports/spacestatistics.py index acaeace5..9ccbc6b5 100644 --- a/myems-api/reports/spacestatistics.py +++ b/myems-api/reports/spacestatistics.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND') space = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -464,10 +464,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/storecost.py b/myems-api/reports/storecost.py index 4a26ffc7..55700365 100644 --- a/myems-api/reports/storecost.py +++ b/myems-api/reports/storecost.py @@ -145,10 +145,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND') store = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -455,10 +455,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/storeenergycategory.py b/myems-api/reports/storeenergycategory.py index 3c732124..e752e688 100644 --- a/myems-api/reports/storeenergycategory.py +++ b/myems-api/reports/storeenergycategory.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND') store = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -469,10 +469,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/storeenergyitem.py b/myems-api/reports/storeenergyitem.py index b09c5e8f..14e0ed98 100644 --- a/myems-api/reports/storeenergyitem.py +++ b/myems-api/reports/storeenergyitem.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND') store = dict() @@ -203,10 +203,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_ITEM_NOT_FOUND') @@ -461,10 +461,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/storeload.py b/myems-api/reports/storeload.py index d7f41b43..7bc04fc3 100644 --- a/myems-api/reports/storeload.py +++ b/myems-api/reports/storeload.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND') store = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -460,10 +460,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/storesaving.py b/myems-api/reports/storesaving.py index 9a7f99d0..651548c7 100644 --- a/myems-api/reports/storesaving.py +++ b/myems-api/reports/storesaving.py @@ -153,10 +153,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND') store = dict() @@ -214,10 +214,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -586,10 +586,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/storestatistics.py b/myems-api/reports/storestatistics.py index d1e61ae7..a5c2f16a 100644 --- a/myems-api/reports/storestatistics.py +++ b/myems-api/reports/storestatistics.py @@ -146,10 +146,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND') store = dict() @@ -202,10 +202,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -465,10 +465,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/tenantcost.py b/myems-api/reports/tenantcost.py index a02c7991..cad4f0a7 100644 --- a/myems-api/reports/tenantcost.py +++ b/myems-api/reports/tenantcost.py @@ -145,10 +145,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.TENANT_NOT_FOUND') tenant = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -455,10 +455,10 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/tenantenergycategory.py b/myems-api/reports/tenantenergycategory.py index 56b9ef36..c5827be6 100644 --- a/myems-api/reports/tenantenergycategory.py +++ b/myems-api/reports/tenantenergycategory.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.TENANT_NOT_FOUND') tenant = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -469,10 +469,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/tenantenergyitem.py b/myems-api/reports/tenantenergyitem.py index 8ca3d4c0..515589db 100644 --- a/myems-api/reports/tenantenergyitem.py +++ b/myems-api/reports/tenantenergyitem.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.TENANT_NOT_FOUND') tenant = dict() @@ -203,10 +203,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_ITEM_NOT_FOUND') @@ -461,10 +461,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/tenantload.py b/myems-api/reports/tenantload.py index e3726abc..a87b02e7 100644 --- a/myems-api/reports/tenantload.py +++ b/myems-api/reports/tenantload.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.TENANT_NOT_FOUND') tenant = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -460,10 +460,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/tenantsaving.py b/myems-api/reports/tenantsaving.py index 46217ac5..bf503c47 100644 --- a/myems-api/reports/tenantsaving.py +++ b/myems-api/reports/tenantsaving.py @@ -153,10 +153,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.TENANT_NOT_FOUND') tenant = dict() @@ -214,10 +214,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -586,10 +586,10 @@ class Reporting: if cnx_energy_baseline: cnx_energy_baseline.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/tenantstatistics.py b/myems-api/reports/tenantstatistics.py index ac70b966..3f189a5c 100644 --- a/myems-api/reports/tenantstatistics.py +++ b/myems-api/reports/tenantstatistics.py @@ -145,10 +145,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.TENANT_NOT_FOUND') tenant = dict() @@ -201,10 +201,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.ENERGY_CATEGORY_NOT_FOUND') @@ -464,10 +464,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = dict() diff --git a/myems-api/reports/virtualmetercost.py b/myems-api/reports/virtualmetercost.py index 602d0a1e..eb1f1e0f 100644 --- a/myems-api/reports/virtualmetercost.py +++ b/myems-api/reports/virtualmetercost.py @@ -341,11 +341,6 @@ class Reporting: if cnx_billing: cnx_billing.disconnect() - if cnx_historical: - cnx_historical.close() - if cursor_historical: - cursor_historical.disconnect() - result = { "virtual_meter": { "cost_center_id": virtual_meter['cost_center_id'], diff --git a/myems-api/reports/virtualmeterenergy.py b/myems-api/reports/virtualmeterenergy.py index 8fe54734..2464d421 100644 --- a/myems-api/reports/virtualmeterenergy.py +++ b/myems-api/reports/virtualmeterenergy.py @@ -281,10 +281,10 @@ class Reporting: if cnx_energy: cnx_energy.disconnect() - if cnx_historical: - cnx_historical.close() if cursor_historical: - cursor_historical.disconnect() + cursor_historical.close() + if cnx_historical: + cnx_historical.disconnect() result = { "virtual_meter": {