Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change day validation priority #222

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ Changelog
2.8.4 (unreleased)
------------------

- Nothing changed yet.

- 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]

2.8.3 (2024-11-28)
------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
12 changes: 5 additions & 7 deletions src/redturtle/prenotazioni/io_tools/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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,
)