From 4401adfebbd8259836b1b481d36e56f506038314 Mon Sep 17 00:00:00 2001 From: kbe Date: Fri, 25 Jul 2025 15:50:09 +0200 Subject: [PATCH] chore: no more 80% match for booking --- crossfit_booker.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/crossfit_booker.py b/crossfit_booker.py index 7ef6c7d..ebb4bfc 100644 --- a/crossfit_booker.py +++ b/crossfit_booker.py @@ -358,7 +358,7 @@ class CrossFitBooker: def matches_preferred_session(self, session: Dict[str, Any], current_time: datetime) -> bool: """ - Check if session matches one of your preferred sessions with fuzzy matching. + Check if session matches one of your preferred sessions with exact matching. Args: session (Dict[str, Any]): Session data. current_time (datetime): Current time for comparison. @@ -375,25 +375,12 @@ class CrossFitBooker: session_name: str = session.get("name_activity", "").upper() for preferred_day, preferred_time, preferred_name in PREFERRED_SESSIONS: - # Exact match first + # Exact match if (day_of_week == preferred_day and session_time_str == preferred_time and preferred_name in session_name): return True - # Fuzzy match fallback (80% similarity) - ratio: float = difflib.SequenceMatcher( - None, - session_name.lower(), - preferred_name.lower() - ).ratio() - - if (day_of_week == preferred_day and - abs(session_time.hour - int(preferred_time.split(':')[0])) <= 1 and - ratio >= 0.8): - logging.debug(f"Fuzzy match: {session_name} → {preferred_name} ({ratio:.2%})") - return True - return False except Exception as e: