mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
completed build of new demo portfolio - some fixed required still
This commit is contained in:
parent
76a03cdf23
commit
3d0ebbb24e
3 changed files with 11 additions and 3 deletions
|
|
@ -73,7 +73,8 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
input_properties = []
|
||||
for config in plan_input:
|
||||
# We validate each record in the file. If the record is NOT valid, we need to handle this accordingly
|
||||
# TODO: implment validation
|
||||
# TODO: implment validation. We should also standardise postcode and address in some fashion as
|
||||
# a postcode of abcdef would be considered different to ABCDEF
|
||||
# Create a record in db
|
||||
property_id, is_new = create_property(
|
||||
session, portfolio_id=body.portfolio_id, address=config['address'], postcode=config['postcode']
|
||||
|
|
@ -310,7 +311,8 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
# 3) the recommendations
|
||||
|
||||
logger.info("Uploading recommendations to the database")
|
||||
for i in range(0, len(input_properties), BATCH_SIZE):
|
||||
session.commit()
|
||||
for i in tqdm(range(0, len(input_properties), BATCH_SIZE)):
|
||||
try:
|
||||
# Take a slice of the input_properties list to make a batch
|
||||
batch_properties = input_properties[i:i + BATCH_SIZE]
|
||||
|
|
@ -323,6 +325,11 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
)
|
||||
create_property_details_epc(session, property_details_epc)
|
||||
|
||||
# TODO: TEMP
|
||||
if p.data["uprn"] == "":
|
||||
print("Get rid of me!")
|
||||
p.data["uprn"] = 0
|
||||
|
||||
property_data = p.get_full_property_data()
|
||||
update_property_data(
|
||||
session, property_id=p.id, portfolio_id=body.portfolio_id, property_data=property_data
|
||||
|
|
|
|||
|
|
@ -3,3 +3,4 @@ import enum
|
|||
|
||||
class QuantityUnits(enum.Enum):
|
||||
m2 = "m2"
|
||||
part = "part"
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class VentilationRecommendations(Definitions):
|
|||
|
||||
part[0]["estimated_cost"] = estimated_cost
|
||||
part[0]["quantity"] = n_units
|
||||
part[0]["quantity_unit"] = None
|
||||
part[0]["quantity_unit"] = "part"
|
||||
|
||||
# We recommend installing two mechanical ventilation systems
|
||||
self.recommendation = [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue