alchemy functions updated

This commit is contained in:
berkay 2024-11-10 13:39:34 +03:00
parent be100a6615
commit a28d4c22d1
1 changed files with 14 additions and 6 deletions

View File

@ -110,15 +110,23 @@ class BuildDecisionBook(CrudCollection):
year=system_arrow.now().date().year, month=related_date.month, day=1 year=system_arrow.now().date().year, month=related_date.month, day=1
) )
if system_arrow.now().date() <= date_processed: if system_arrow.now().date() <= date_processed:
book = cls.filter_active( book = cls.filter_one(
cls.expiry_ends <= date_processed, cls.expiry_ends <= date_processed,
cls.decision_type == "RBM", cls.decision_type == "RBM",
cls.build_id == related_build.id, cls.build_id == related_build.id,
) ).data
if not book: if not book:
return cls.raise_http_exception(
return book.data[0] status_code="HTTP_404_NOT_FOUND",
else: error_case="NOTFOUND",
message=f"Decision Book is not found for {related_build.build_name}-RBM",
data=dict(
build_id=str(related_build.uu_id),
build_name=related_build.build_name,
decision_type="RBM",
)
)
return book
return return
@classmethod @classmethod