From 60b726d7e9e1705b5741a5e02cfdc9aa4c3ec908 Mon Sep 17 00:00:00 2001 From: mytja Date: Tue, 3 Oct 2023 17:29:20 +0200 Subject: [PATCH] fix absences in case of afternoon hours --- gimsisapi/formtagparser.py | 10 ++++++++-- main.py | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gimsisapi/formtagparser.py b/gimsisapi/formtagparser.py index 9637ba4..0485d69 100644 --- a/gimsisapi/formtagparser.py +++ b/gimsisapi/formtagparser.py @@ -199,10 +199,16 @@ def get_absences(text, type: int): current_day = f[0].text.strip() days[current_day] = [] f = f[1:] - + + u = f[0].text.strip() + if "P" in u: + ura = 7 + int(u.replace("P", "")) + else: + ura = int(u) + days[current_day].append( SubjectAbsenceStatus( - int(f[0].text.strip()), + ura, f[1].text.strip(), f[2].text.strip(), f[3].find("div").text.strip(), diff --git a/main.py b/main.py index 3119dec..41a178a 100644 --- a/main.py +++ b/main.py @@ -12,12 +12,12 @@ async def main(): # classes, days = await gimsis.fetch_timetable() # print(classes, days) # await gimsis.fetch_timetable("12 09 2022") - # absences = await gimsis.fetch_absences("01.09.2022", type=AbsenceType.by_days) - # print(absences) + absences = await gimsis.fetch_absences("01.09.2022", type=AbsenceType.by_days) + print(absences) # gradings = await gimsis.fetch_gradings() # print(gradings) - grades = await gimsis.fetch_grades() - print(grades) + #grades = await gimsis.fetch_grades(year=2022) + #print(grades) #profile = await gimsis.my_profile() #print(profile) #teachers = await gimsis.fetch_teachers()