Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
Pilar Monsalvete 2023-07-31 14:42:21 -04:00
commit 98a60fa0a1
2 changed files with 13 additions and 5 deletions

View File

@ -9,6 +9,7 @@ from pathlib import Path
from hub.persistence.db_control import DBControl
from hub.persistence.repository import Repository
from hub.catalog_factories.energy_systems_catalog_factory import EnergySystemsCatalogFactory
class Config:
@ -23,6 +24,7 @@ class Config:
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._energy_systems_catalog = EnergySystemsCatalogFactory('montreal_custom').catalog
@property
def database(self):
@ -31,3 +33,7 @@ class Config:
@property
def repository(self):
return self._repository
@property
def energy_systems_catalog(self):
return self._energy_systems_catalog

View File

@ -31,15 +31,17 @@ class RetrofitResults(Resource, Config):
# retrieve the buildings info
buildings = []
buildings_info = []
scenario_name = None
for scenario in payload['scenarios']:
key = next(iter(scenario))
for name in scenario[key]:
scenario_name = next(iter(scenario))
for name in scenario[scenario_name]:
if name not in buildings:
buildings.append(name)
for building in buildings:
buildings_info.append(self.database.building_info(building, user_id, application_id, scenario))
print(buildings_info)
building_info = self.database.building(building, user_id, application_id, scenario_name)
self.energy_systems_catalog.get_entry(building_info.system_name)
buildings_info.append(building_info)
results = self.database.results(user_id, application_id, payload)
if results == {}:
# no data found for the given parameters