event decision book item updated

This commit is contained in:
2024-11-17 19:55:17 +03:00
parent 295dbe2cd8
commit 58ee49a1fc
8 changed files with 114 additions and 107 deletions

View File

@@ -230,7 +230,7 @@ class Build(CrudCollection, SelectActionWithEmployee):
def management_room(self):
if management_room := BuildParts.filter_by_one(
system=True, id=self.management_room_id, build_id=self.id
):
).data:
return management_room
return None

View File

@@ -566,7 +566,9 @@ class BuildDecisionBookItems(CrudCollection):
item_comment: Mapped[str] = mapped_column(
Text, nullable=False, comment="Comment Content"
)
item_objection: Mapped[str] = mapped_column(Text)
item_objection: Mapped[str] = mapped_column(
Text, nullable=True, comment="Objection Content"
)
info_is_completed: Mapped[bool] = mapped_column(
Boolean, server_default="0", comment="Info process is Completed"
)
@@ -599,6 +601,19 @@ class BuildDecisionBookItems(CrudCollection):
foreign_keys="BuildDecisionBookProjects.build_decision_book_item_id",
)
__table_args__ = (
Index("_build_decision_book_item_ndx_01", build_decision_book_id),
Index(
"_build_decision_book_item_ndx_02",
build_decision_book_id,
item_order,
unique=True,
),
{
"comment": "Decision Book Items that are related to decision taken at building meetings"
},
)
@classmethod
def select_action(cls, duty_id, token=None):
from databases import (
@@ -668,7 +683,7 @@ class BuildDecisionBookItems(CrudCollection):
BuildDecisionBookInvitations.id == active_invite.id
).data
people_book_attend_count = None
if invitation.invitation_attempt == 1:
if int(invitation.invitation_attempt) == 1:
people_book_attend_is_attending = BuildDecisionBookPerson.filter_all(
BuildDecisionBookPerson.invite_id == invitation.id,
BuildDecisionBookPerson.is_attending == True,
@@ -678,7 +693,7 @@ class BuildDecisionBookItems(CrudCollection):
[person.id for person in people_book_attend_is_attending.data]
),
BuildDecisionBookPersonOccupants.occupant_type_id.in_(
[occupant_type.id for occupant_type in occupant_type_list.data]
[occupant_type.id for occupant_type in occupant_type_list]
),
)
people_book_attend_count = people_book_attend.count
@@ -719,7 +734,7 @@ class BuildDecisionBookItems(CrudCollection):
== person_occupants_pre.build_decision_book_person_id
).data
person = People.filter_one(People.id == person_invite_pret.person_id).data
BuildDecisionBookItems.find_or_create(
created_attendance = BuildDecisionBookItems.find_or_create(
**book_items_dict,
item_order=1,
item_comment=comment(
@@ -728,6 +743,7 @@ class BuildDecisionBookItems(CrudCollection):
full_name=person.full_name,
),
)
created_attendance.save_and_confirm()
person_occupants_wrt = BuildDecisionBookPersonOccupants.filter_one(
BuildDecisionBookPersonOccupants.invite_id == invitation.id,
@@ -738,7 +754,7 @@ class BuildDecisionBookItems(CrudCollection):
== person_occupants_wrt.build_decision_book_person_id
).data
person = People.filter_one(People.id == person_invite_pret.person_id).data
BuildDecisionBookItems.find_or_create(
created_attendance = BuildDecisionBookItems.find_or_create(
**book_items_dict,
item_order=2,
item_comment=comment(
@@ -747,6 +763,7 @@ class BuildDecisionBookItems(CrudCollection):
full_name=person.full_name,
),
)
created_attendance.save_and_confirm()
person_occupants_mng = BuildDecisionBookPersonOccupants.filter_one(
BuildDecisionBookPersonOccupants.invite_id == invitation.id,
@@ -757,7 +774,7 @@ class BuildDecisionBookItems(CrudCollection):
== person_occupants_mng.build_decision_book_person_id
).data
person = People.filter_one(People.id == person_invite_pret.person_id).data
BuildDecisionBookItems.find_or_create(
created_attendance = BuildDecisionBookItems.find_or_create(
**book_items_dict,
item_order=3,
item_comment=comment(
@@ -766,20 +783,10 @@ class BuildDecisionBookItems(CrudCollection):
full_name=person.full_name,
),
)
created_attendance.save_and_confirm()
return people_book_attend_count
__table_args__ = (
Index("_build_decision_book_item_ndx_01", build_decision_book_id),
Index(
"_build_decision_book_item_ndx_02",
build_decision_book_id,
item_order,
unique=True,
),
{
"comment": "Decision Book Items that are related to decision taken at building meetings"
},
)
class BuildDecisionBookItemsUnapproved(CrudCollection):
@@ -875,14 +882,14 @@ class BuildDecisionBookPayments(CrudCollection):
ForeignKey("build_parts.id"), nullable=False
)
build_parts_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Build Part UUID"
String, nullable=False, comment="Build Part UUID"
)
budget_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"))
budget_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=True)
budget_records_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Budget UUID"
)
accounting_id: Mapped[int] = mapped_column(ForeignKey("account_detail.id"))
accounting_id: Mapped[int] = mapped_column(ForeignKey("account_detail.id"), nullable=True)
accounting_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Accounting UUID"
)