All methods are in the right class
This commit is contained in:
parent
0d541e82a5
commit
7f59443b64
12 changed files with 585 additions and 1729 deletions
|
@ -39,24 +39,12 @@ async def cancel_booking(club: Club, user: User, booking_filter: BookingFilter)
|
|||
await service.cancel_booking(user, club, booking_filter)
|
||||
|
||||
|
||||
async def cancel_booking_id(club: Club, user: User, booking_id: int) -> None:
|
||||
"""
|
||||
Cancel a booking that matches the booking id
|
||||
|
||||
:param club: the club in which the booking was made
|
||||
:param user: the user who made the booking
|
||||
:param booking_id: the id of the booking to cancel
|
||||
"""
|
||||
service = GestionSportsServices()
|
||||
await service.cancel_booking_id(user, club, booking_id)
|
||||
|
||||
|
||||
async def get_tournaments(club: Club, user: User) -> list[Tournament]:
|
||||
"""
|
||||
Cancel a booking that matches the booking id
|
||||
Get the list of all current tournaments, their price, date and availability
|
||||
|
||||
:param club: the club in which the booking was made
|
||||
:param user: the user who made the booking
|
||||
:param club: the club in which the tournaments are
|
||||
:param user: a user of the club in order to retrieve the information
|
||||
"""
|
||||
service = GestionSportsServices()
|
||||
return await service.get_all_tournaments(user, club)
|
||||
|
@ -74,17 +62,23 @@ def main() -> tuple[Court, User] | list[Tournament] | None:
|
|||
club = config.get_club()
|
||||
users = config.get_users(club.id)
|
||||
booking_filter = config.get_booking_filter()
|
||||
LOGGER.info(
|
||||
f"Booking a court of {booking_filter.sport_name} at {booking_filter.date} "
|
||||
f"at club {club.name}"
|
||||
)
|
||||
court_booked, user = asyncio.run(book_court(club, users, booking_filter))
|
||||
if court_booked:
|
||||
LOGGER.info(
|
||||
"Court %s booked successfully at %s for user %s",
|
||||
court_booked,
|
||||
booking_filter.date,
|
||||
user,
|
||||
f"Court of {booking_filter.sport_name} {court_booked} was booked "
|
||||
f"successfully at {booking_filter.date} at club {club.name} "
|
||||
f"for user {user}"
|
||||
)
|
||||
return court_booked, user
|
||||
else:
|
||||
LOGGER.info("Booking did not work")
|
||||
LOGGER.info(
|
||||
f"No court of {booking_filter.sport_name} at {booking_filter.date} "
|
||||
f"at club {club.name} was booked"
|
||||
)
|
||||
|
||||
elif action == Action.CANCEL:
|
||||
user = config.get_user()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue