save and confirmed added

This commit is contained in:
2024-11-17 16:30:50 +03:00
parent 7e1b26f3c4
commit 295dbe2cd8
48 changed files with 922 additions and 697 deletions

View File

@@ -32,9 +32,7 @@ class ModulesBindOccupantEventMethods(MethodToEvent):
living_space = BuildLivingSpace.filter_one(
BuildLivingSpace.id == build_living_space_id,
).data
modules = Modules.filter_one(
Modules.id == modules_id
).data
modules = Modules.filter_one(Modules.id == modules_id).data
if not living_space or not modules:
print(f"Giving living Space or Modules: {modules.module_name} not found")
@@ -43,7 +41,9 @@ class ModulesBindOccupantEventMethods(MethodToEvent):
if expires_at:
service_build_dict["expires_at"] = str(system_arrow.get(expires_at))
else:
service_build_dict["expires_at"] = str(system_arrow.get(living_space.expiry_ends))
service_build_dict["expires_at"] = str(
system_arrow.get(living_space.expiry_ends)
)
for service in modules.retrieve_services():
ServiceBindOccupantEventMethods.bind_services_occupant_system(

View File

@@ -35,6 +35,7 @@ class ServiceBindOccupantEventMethods(MethodToEvent):
cls, build_living_space_id: int, service_id: int, expires_at: str = None
):
from sqlalchemy.dialects.postgresql import insert
living_space = BuildLivingSpace.filter_one(
BuildLivingSpace.id == build_living_space_id,
).data
@@ -218,10 +219,8 @@ class ServiceBindEmployeeEventMethods(MethodToEvent):
)
count_row = session_execute.rowcount
print(f"{count_row} events are added to employee {employee.uu_id}")
Services.save()
for service_event in service_events:
service_event.is_confirmed = True
Service2Events.save()
service_event.save_and_confirm()
@classmethod
def bind_services_employee_super_user(