Refactored city removal from session

This commit is contained in:
Peter Yefi 2023-01-17 19:02:49 -05:00
parent f893959c78
commit aa9cc24f29
2 changed files with 7 additions and 20 deletions

View File

@ -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/<int:city_id>')
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/<int:city_id>')
# 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/<int:city_id>')
api.add_resource(MaterialLCACalculations, '/v1.4/material_lca_catalog/calculations/<int:city_id>')
api.add_resource(HeatPump, '/v1.4/heat-pump/<int:city_id>')
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/<int:city_id>')
api.add_resource(City, '/v1.4/city')
api.add_resource(Greenery, '/v1.4/greenery')

View File

@ -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():