Fixed SelectionCriteria Filtering. Date wasn't added to pydantic model

This commit is contained in:
Jonas Linter
2025-10-09 09:22:52 +02:00
parent 69fb1374b2
commit 18d30a140f
2 changed files with 7 additions and 2 deletions

View File

@@ -505,6 +505,9 @@ class ReadAction(AlpineBitsAction):
start_date = None
"""When given, the server will send only inquiries generated after the Start timestamp, regardless
whether the client has retrieved them before or not."""
if hotel_read_request.selection_criteria is not None:
start_date = datetime.fromisoformat(
hotel_read_request.selection_criteria.start
@@ -518,7 +521,8 @@ class ReadAction(AlpineBitsAction):
.filter(Reservation.hotel_code == hotelid)
)
if start_date:
stmt = stmt.filter(Reservation.start_date >= start_date)
_LOGGER.info("Filtering reservations from start date %s", start_date)
stmt = stmt.filter(Reservation.created_at >= start_date)
# remove reservations that have been acknowledged via client_id
elif client_info.client_id:
subquery = (