user selection compoleted tested

This commit is contained in:
2025-06-15 19:05:48 +03:00
parent a48e560ece
commit 9fb517fa15
24 changed files with 574 additions and 313 deletions

View File

@@ -238,9 +238,14 @@ class Build(CrudCollection):
building_types = None
for part in self.parts:
building_types = {}
build_type = BuildTypes.filter_by_one(
system=True, id=part.build_part_type_id, db=db_session
).data
build_type = BuildTypes.query.filter(
BuildTypes.id == part.build_part_type_id
).first()
if not build_type:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail="There is no building type in this building.",
)
if build_type.type_code in building_types:
building_types[build_type.type_code]["list"].append(part.part_no)
else:
@@ -327,9 +332,10 @@ class BuildParts(CrudCollection):
)
def part_name(self, db):
if build_type := BuildTypes.filter_by_one(
system=True, id=self.part_type_id, db=db
).data:
BuildTypes.set_session(db)
if build_type := BuildTypes.query.filter(
BuildTypes.id == self.part_type_id
).first():
return f"{str(build_type.type_name).upper()} : {str(self.part_no).upper()}"
return f"Undefined:{str(build_type.type_name).upper()}"