mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
update floor recommendations for suspended floor
This commit is contained in:
parent
96553d0fc0
commit
80b4d2390c
3 changed files with 6 additions and 14 deletions
|
|
@ -1,4 +1,5 @@
|
|||
from backend.app.db.models.materials import Material
|
||||
from backend.app.db.utils import row2dict
|
||||
from functools import lru_cache
|
||||
|
||||
|
||||
|
|
@ -16,4 +17,6 @@ def get_materials(session):
|
|||
|
||||
materials = session.query(Material).filter(Material.is_active).all()
|
||||
|
||||
return materials if materials else []
|
||||
materials = materials if materials else []
|
||||
|
||||
return [row2dict(material) for material in materials]
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ from backend.app.db.models.portfolio import rating_lookup
|
|||
from backend.app.dependencies import validate_token
|
||||
from backend.app.plan.schemas import PlanTriggerRequest
|
||||
from backend.app.plan.utils import (
|
||||
create_recommendation_scoring_data, prepare_materials, get_cleaned, insert_temp_recommendation_id
|
||||
create_recommendation_scoring_data, get_cleaned, insert_temp_recommendation_id
|
||||
)
|
||||
from backend.app.utils import epc_to_sap_lower_bound, read_csv_from_s3, read_parquet_from_s3
|
||||
|
||||
|
|
@ -114,7 +114,6 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
# the same data
|
||||
logger.info("Reading in materials and cleaned datasets")
|
||||
materials = get_materials(session)
|
||||
materials = prepare_materials(materials)
|
||||
cleaned = get_cleaned()
|
||||
|
||||
logger.info("Getting components and epc recommendations")
|
||||
|
|
@ -141,7 +140,7 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
|
||||
# Wall recommendations
|
||||
|
||||
wall_recomender = WallRecommendations(property_instance=p, materials=materials_by_type["walls"])
|
||||
wall_recomender = WallRecommendations(property_instance=p, materials=materials)
|
||||
wall_recomender.recommend()
|
||||
|
||||
if wall_recomender.recommendations:
|
||||
|
|
|
|||
|
|
@ -4,20 +4,10 @@ from utils.s3 import read_from_s3
|
|||
|
||||
from recommendations.recommendation_utils import get_wall_u_value, get_floor_u_value, get_roof_u_value
|
||||
|
||||
from backend.app.db.utils import row2dict
|
||||
from backend.app.config import get_settings
|
||||
import msgpack
|
||||
|
||||
|
||||
def prepare_materials(materials):
|
||||
"""
|
||||
This function will prepare the materials for recommendations
|
||||
:param materials: list of materials, as retrieved from the database
|
||||
:return:
|
||||
"""
|
||||
return [row2dict(material) for material in materials]
|
||||
|
||||
|
||||
def insert_temp_recommendation_id(property_recommendations):
|
||||
"""
|
||||
Creates a temporary recommendation id which is needed for
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue