From 4ed9a4353394d363e3195d10386ae156dba0769b Mon Sep 17 00:00:00 2001 From: Roman Kysil Date: Mon, 2 Dec 2024 15:17:52 +0100 Subject: [PATCH 1/3] Change day validation priority --- CHANGES.rst | 3 ++- .../prenotazioni/browser/prenotazioni_context_state.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 26c18624..f687178e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,8 @@ Changelog 2.8.4 (unreleased) ------------------ -- Nothing changed yet. +- Fix first available day result. + [folix-01] 2.8.3 (2024-11-28) diff --git a/src/redturtle/prenotazioni/browser/prenotazioni_context_state.py b/src/redturtle/prenotazioni/browser/prenotazioni_context_state.py index 8a5ea422..5d6d9f4a 100644 --- a/src/redturtle/prenotazioni/browser/prenotazioni_context_state.py +++ b/src/redturtle/prenotazioni/browser/prenotazioni_context_state.py @@ -311,6 +311,9 @@ def is_valid_day(self, day, bypass_user_restrictions=False): is_configured_day = self.is_configured_day(day) + if self.is_vacation_day(day): + return False + if bypass_user_restrictions: return True @@ -324,9 +327,6 @@ def is_valid_day(self, day, bypass_user_restrictions=False): if day < self.first_bookable_day: return False - if self.is_vacation_day(day): - return False - if self.last_bookable_day and day > self.last_bookable_day: return False From 3e2dac817613a73237a5e5b5d9220fdb33554c9e Mon Sep 17 00:00:00 2001 From: Roman Kysil Date: Mon, 2 Dec 2024 15:29:23 +0100 Subject: [PATCH 2/3] Changelog + lower log lever for AppIO api connector --- CHANGES.rst | 5 +++-- src/redturtle/prenotazioni/io_tools/api.py | 12 +++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index f687178e..6a469772 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,9 +5,10 @@ Changelog 2.8.4 (unreleased) ------------------ -- Fix first available day result. +- Change the date validation order, if day is vacation, it is not possibile to book. + [folix-01] +- Lower log level for AppIO exceptions [folix-01] - 2.8.3 (2024-11-28) ------------------ diff --git a/src/redturtle/prenotazioni/io_tools/api.py b/src/redturtle/prenotazioni/io_tools/api.py index 343ee51c..21228154 100644 --- a/src/redturtle/prenotazioni/io_tools/api.py +++ b/src/redturtle/prenotazioni/io_tools/api.py @@ -108,17 +108,17 @@ def send_message( """ # 0. validazione argomenti if len(subject) < 10 or len(subject) > 120: - logger.error( + logger.warning( "la lunghezza dell'oggetto del messaggio deve stare tra i 10 e i 120 caratteri" ) return None if len(body) < 80 or len(body) > 10000: - logger.error( + logger.warning( "la lunghezza del contenuto del messaggio deve stare tra i 80 e i 10.000 caratteri" ) return None if due_date and not isinstance(due_date, datetime): - logger.error( + logger.warning( "il campo con la data, se valorizzato, deve essere di tipo datetime" ) return None @@ -209,9 +209,7 @@ def get_profile(self, fiscal_code): ) except Exception: - logger.exception( - "profile for user %s not found (generic error)", fiscal_code - ) + logger.warning("profile for user %s not found (generic error)", fiscal_code) return None @@ -237,7 +235,7 @@ def is_service_activated(self, fiscal_code): ) except Exception: - logger.exception( + logger.warning( "subsctiprion not found for user %s (generic error)", fiscal_code, ) From 393a768bb4bec92c7c43f4d947e928ef175b4760 Mon Sep 17 00:00:00 2001 From: Roman Kysil Date: Mon, 2 Dec 2024 15:31:03 +0100 Subject: [PATCH 3/3] Changelog --- CHANGES.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 6a469772..222abb22 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,8 @@ Changelog 2.8.4 (unreleased) ------------------ -- Change the date validation order, if day is vacation, it is not possibile to book. +- Change date validation order, if the validated + day is vacation, it is not possibile to book. [folix-01] - Lower log level for AppIO exceptions [folix-01]