From 6da22801c8dd613ad7d97feea7db24e0852f41b2 Mon Sep 17 00:00:00 2001 From: i Date: Sun, 8 Feb 2026 13:09:36 +0100 Subject: [PATCH] add bookingquotaid relative --- .gitignore | 3 ++- booking/client.py | 4 ++-- config/constants.py | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index bb2a8a3..aea77cd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ __pycache__/ venv -log.txt \ No newline at end of file +log.txt +test.py \ No newline at end of file diff --git a/booking/client.py b/booking/client.py index 207a0b6..9b91a64 100644 --- a/booking/client.py +++ b/booking/client.py @@ -6,6 +6,7 @@ from config.constants import ( CHECKOUT_FORM_API, ANNY_BASE_URL, SERVICE_ID, + BOOKING_QUOTA_GRANT_ID, ) @@ -72,8 +73,7 @@ class BookingClient: "add_ons_by_service": {SERVICE_ID: [[]]}, "sub_bookings_by_service": {}, # INFO: changes every week: e.g. booking for a monday needs new id - # "booking_quota_grant_id":"24735199", - "booking_quota_grant_id": "24735202", + "booking_quota_grant_id": str(BOOKING_QUOTA_GRANT_ID), "strategy": "multi-resource", }, # data = '{"resource_id":["15994"],"service_id":{"601":1},"start_date":"2026-02-03T22:30:00+01:00","end_date":"2026-02-03T23:30:00+01:00","description":"","customer_note":"","add_ons_by_service":{"601":[[]]},"sub_bookings_by_service":{},"booking_quota_grant_id":"24735199","strategy":"multi-resource"}' diff --git a/config/constants.py b/config/constants.py index 31144c8..36ce402 100644 --- a/config/constants.py +++ b/config/constants.py @@ -1,3 +1,4 @@ +from datetime import datetime AUTH_BASE_URL = "https://auth.anny.eu" ANNY_BASE_URL = "https://anny.eu" BOOKING_API_BASE = "https://b.anny.eu/api/v1" @@ -15,6 +16,19 @@ SERVICE_ID = "601" # RESOURCE_ID = None RESOURCE_IDS = [15883, 15502, 15880, 15505, 15892] + +# tum only: +# last: "booking_quota_grant_id":"24735199", +# -> every THURSDAY IT HAS TO BE +3 cuz reservation is for monday (changes to +3 of last) + +INITIAL_BOOKING_QUOTA_GRANT_ID = 24735199 +initial_date = datetime(2026, 1, 28) +current_date = datetime.now() +days_passed = (current_date - initial_date).days +weeks_passed = days_passed // 7 +BOOKING_QUOTA_GRANT_ID = INITIAL_BOOKING_QUOTA_GRANT_ID + 3*weeks_passed +print(BOOKING_QUOTA_GRANT_ID) + TIMEZONE = "Europe/Berlin" # SSO_PROVIDER = "kit" # Available: kit (add more in auth/providers/) SSO_PROVIDER = "tum" # Available: kit (add more in auth/providers/)