Big refactoring.

- clubs, booking platforms and user are now defined in customization files -> there are less environment variables
- the responsibility of the session moved
- booking cancellation is available
This commit is contained in:
Stanislas Jouffroy 2024-03-17 23:57:50 +01:00 committed by stanislas
parent dbda5a158e
commit 0938fb98b7
27 changed files with 3050 additions and 696 deletions

View file

@ -1,5 +1,6 @@
from urllib.parse import urljoin
import pendulum
from models import BookingFilter, Club
from pendulum import DateTime
@ -7,7 +8,6 @@ from tests.fixtures import (
a_booking_failure_response,
a_booking_filter,
a_booking_success_response,
a_club,
mes_resas_html,
)
@ -65,11 +65,13 @@ def retrieve_booking_datetime(
:param a_booking_filter: the booking filter that contains the date to book
:param a_club: the club which has the number of days before the date and the booking time
"""
booking_hour = a_club.booking_opening_time.hour
booking_minute = a_club.booking_opening_time.minute
booking_opening = a_club.booking_platform.booking_opening
opening_time = pendulum.parse(booking_opening.opening_time)
booking_hour = opening_time.hour
booking_minute = opening_time.minute
date_to_book = a_booking_filter.date
return date_to_book.subtract(days=a_club.booking_open_days_before).at(
return date_to_book.subtract(days=booking_opening.days_before).at(
booking_hour, booking_minute
)