fix: matches_prefered_session wrong api variable

Now it uses `start_timestamp` instead of
`start_datetime` which is no presented in the API.
This commit is contained in:
kbe
2025-07-18 12:23:36 +02:00
parent 3f9ec46184
commit 8dc18d2f0f

View File

@@ -243,7 +243,7 @@ class CrossFitBooker:
def is_session_bookable(self, session: Dict, current_time: datetime) -> bool:
"""Check if a session is bookable based on user_info, ignoring error codes."""
user_info = session.get("user_info", {})
# First check if can_join is true (primary condition)
if user_info.get("can_join", False):
return True
@@ -273,7 +273,7 @@ class CrossFitBooker:
def matches_preferred_session(self, session: Dict, current_time: datetime) -> bool:
"""Check if session matches one of your preferred sessions"""
try:
session_time = datetime.strptime(session["start_datetime"], "%Y-%m-%d %H:%M:%S")
session_time = datetime.strptime(session["start_timestamp"], "%Y-%m-%d %H:%M:%S")
session_time = pytz.timezone(TIMEZONE).localize(session_time)
# Check if session is exactly 2 days from now