From aa9cc24f29b352d2154a951d41afd96b17dbb8a0 Mon Sep 17 00:00:00 2001 From: Peter Yefi Date: Tue, 17 Jan 2023 19:02:49 -0500 Subject: [PATCH] Refactored city removal from session --- bootstrap.py | 14 +++++++------- gamification.py | 13 ------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/bootstrap.py b/bootstrap.py index 79f2d92..0f195b6 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -29,7 +29,7 @@ from hub_api.session import SessionStart, SessionEnd, KeepSessionAlive from hub_api.uptime import Uptime from hub_api.greenery import Greenery from hub_api.user import User, UserLogin -from flasgger import LazyJSONEncoder, LazyString, Swagger +from flasgger import LazyJSONEncoder, Swagger app = flask.Flask('gamification') app.json_encoder = LazyJSONEncoder @@ -64,21 +64,21 @@ api.add_resource(GreeneryCatalogNames, '/v1.4/greenery-catalog/names') api.add_resource(ConstructionCatalogEntry, '/v1.4/construction-catalog/entry') api.add_resource(ConstructionCatalogEntries, '/v1.4/construction-catalog/entries') api.add_resource(ConstructionCatalogNames, '/v1.4/construction-catalog/names') -api.add_resource(Construction, '/v1.4/construction') +api.add_resource(Construction, '/v1.4/construction/') api.add_resource(UsageCatalogEntry, '/v1.4/usage-catalog/entry') api.add_resource(UsageCatalogEntries, '/v1.4/usage-catalog/entries') api.add_resource(UsageCatalogNames, '/v1.4/usage-catalog/names') api.add_resource(Usage, '/v1.4/usage') -api.add_resource(EnergyDemand, '/v1.4/energy-demand') +api.add_resource(EnergyDemand, '/v1.4/energy-demand/') # api.add_resource(LCA, '/v1.4/lca') -api.add_resource(MaterialLCACatalog, '/v1.4/material_lca_catalog/entries') -api.add_resource(MaterialLCACalculations, '/v1.4/material_lca_catalog/calculations') -api.add_resource(HeatPump, '/v1.4/heat-pump') +api.add_resource(MaterialLCACatalog, '/v1.4/material_lca_catalog/entries/') +api.add_resource(MaterialLCACalculations, '/v1.4/material_lca_catalog/calculations/') +api.add_resource(HeatPump, '/v1.4/heat-pump/') api.add_resource(User, '/v1.4/user') api.add_resource(UserLogin, '/v1.4/user/login') api.add_resource(SessionStart, '/v1.4/session/start') api.add_resource(SessionEnd, '/v1.4/session/end') api.add_resource(KeepSessionAlive, '/v1.4/session/keep_alive') -api.add_resource(CityInfo, '/v1.4/city_info') +api.add_resource(CityInfo, '/v1.4/city/') api.add_resource(City, '/v1.4/city') api.add_resource(Greenery, '/v1.4/greenery') diff --git a/gamification.py b/gamification.py index 1599e1e..211fa75 100644 --- a/gamification.py +++ b/gamification.py @@ -53,19 +53,6 @@ WeatherFactory('epw', city, file_name=montreal_weather_file).enrich() city.name = 'Montreal' city.climate_reference_city = 'Montreal' -# SRA Calculations - -for building in city.buildings: - building.heated = True - building.cooled = True - building.attic_heated = 0 - building.basement_heated = 0 - for surface in building.surfaces: - surface.swr = 0.2 - -# Pass the city to the session helper to be used as default status. -sh.city = city - @app.route("/") def home():