feat: add new category and days to schedule argument

🛠️ myice.py -> Added new enum value 'u111' to AgeGroup, modified get_schedule function to accept num_days parameter, added num_days option to schedule function.
This commit is contained in:
2024-11-27 14:32:51 +01:00
parent 5bf970ed26
commit 6b37e0fcc2

View File

@@ -31,6 +31,7 @@ class AgeGroup(str, Enum):
u13p = "U13 (Prép)"
u15t = "U15 (Top)"
u15a = "U15 (A)"
u111 = "U11 (1)"
class EventType(str, Enum):
@@ -141,13 +142,13 @@ def wrapper_session(func):
@wrapper_session
def get_schedule() -> str:
def get_schedule(num_days: int) -> str:
global session
global userid
assert session and userid
now = datetime.datetime.now()
date_start = now
date_end = date_start + datetime.timedelta(days=7)
date_end = date_start + datetime.timedelta(days=num_days)
r = session.post(
"https://app.myice.hockey/inc/processclubplanning.php",
data={
@@ -208,11 +209,12 @@ def schedule(
"--outfile", "-o", help="file to write result to, or stdout if none"
),
] = None,
num_days: Annotated[int, typer.Option("--days")] = 7,
):
"""
Fetch schedule as json
"""
schedule = get_schedule()
schedule = get_schedule(num_days)
if outfile:
with outfile.open("w") as f:
f.write(schedule)