Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
98a60fa0a1
|
@ -9,6 +9,7 @@ from pathlib import Path
|
||||||
|
|
||||||
from hub.persistence.db_control import DBControl
|
from hub.persistence.db_control import DBControl
|
||||||
from hub.persistence.repository import Repository
|
from hub.persistence.repository import Repository
|
||||||
|
from hub.catalog_factories.energy_systems_catalog_factory import EnergySystemsCatalogFactory
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
@ -23,6 +24,7 @@ class Config:
|
||||||
|
|
||||||
self._database = DBControl(db_name=database_name, app_env=environment, dotenv_path=dotenv_path)
|
self._database = DBControl(db_name=database_name, app_env=environment, dotenv_path=dotenv_path)
|
||||||
self._repository = Repository(db_name=database_name, app_env=environment, dotenv_path=dotenv_path)
|
self._repository = Repository(db_name=database_name, app_env=environment, dotenv_path=dotenv_path)
|
||||||
|
self._energy_systems_catalog = EnergySystemsCatalogFactory('montreal_custom').catalog
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def database(self):
|
def database(self):
|
||||||
|
@ -31,3 +33,7 @@ class Config:
|
||||||
@property
|
@property
|
||||||
def repository(self):
|
def repository(self):
|
||||||
return self._repository
|
return self._repository
|
||||||
|
|
||||||
|
@property
|
||||||
|
def energy_systems_catalog(self):
|
||||||
|
return self._energy_systems_catalog
|
||||||
|
|
|
@ -31,15 +31,17 @@ class RetrofitResults(Resource, Config):
|
||||||
# retrieve the buildings info
|
# retrieve the buildings info
|
||||||
buildings = []
|
buildings = []
|
||||||
buildings_info = []
|
buildings_info = []
|
||||||
|
scenario_name = None
|
||||||
|
|
||||||
for scenario in payload['scenarios']:
|
for scenario in payload['scenarios']:
|
||||||
key = next(iter(scenario))
|
scenario_name = next(iter(scenario))
|
||||||
for name in scenario[key]:
|
for name in scenario[scenario_name]:
|
||||||
if name not in buildings:
|
if name not in buildings:
|
||||||
buildings.append(name)
|
buildings.append(name)
|
||||||
for building in buildings:
|
for building in buildings:
|
||||||
buildings_info.append(self.database.building_info(building, user_id, application_id, scenario))
|
building_info = self.database.building(building, user_id, application_id, scenario_name)
|
||||||
|
self.energy_systems_catalog.get_entry(building_info.system_name)
|
||||||
print(buildings_info)
|
buildings_info.append(building_info)
|
||||||
results = self.database.results(user_id, application_id, payload)
|
results = self.database.results(user_id, application_id, payload)
|
||||||
if results == {}:
|
if results == {}:
|
||||||
# no data found for the given parameters
|
# no data found for the given parameters
|
||||||
|
|
Loading…
Reference in New Issue
Block a user