From 5ce2868c5ac7bcd6bc5556331ed265ee16a884a5 Mon Sep 17 00:00:00 2001 From: mytja Date: Fri, 15 Dec 2023 19:39:24 +0100 Subject: [PATCH] popravek za dvojne ocene na celoletnem ocenjevanju --- .gitignore | 1 + gimsisapi/formtagparser.py | 20 ++++++++++++-------- main.py | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index c18dd8d..e1f7009 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ __pycache__/ +test.py diff --git a/gimsisapi/formtagparser.py b/gimsisapi/formtagparser.py index 6bd049e..7c48ca1 100644 --- a/gimsisapi/formtagparser.py +++ b/gimsisapi/formtagparser.py @@ -308,7 +308,7 @@ def get_grades(text): grades = g.find("span").find("span").find_all("span") if len(grades) > 1: grade_nonprimary = [] - grade_primary = None + grade_primary = [] for grade in grades: stalna = "ocVmesna" not in grade["class"] title = grade["title"].strip().splitlines() @@ -332,16 +332,20 @@ def get_grades(text): if not stalna: grade_nonprimary.append(current_grade) continue - grade_primary = current_grade + grade_primary.append(current_grade) total_perm += int(g) total_perm_count += 1 total += int(g) - if grade_primary is not None: - grade_primary.popravljane_ocene = grade_nonprimary - subject_grades[oc_obdobje]["grades"].append(grade_primary) - else: - for grade_non in grade_nonprimary: - subject_grades[oc_obdobje]["grades"].append(grade_non) + + if len(grade_primary) > 0: + for grade in grade_primary: + grade.popravljane_ocene = grade_nonprimary + subject_grades[oc_obdobje]["grades"].append(grade) + continue + + for grade_non in grade_nonprimary: + subject_grades[oc_obdobje]["grades"].append(grade_non) + continue if len(grades) == 0: diff --git a/main.py b/main.py index 3c53474..db64478 100644 --- a/main.py +++ b/main.py @@ -16,7 +16,7 @@ async def main(): #print(absences) # gradings = await gimsis.fetch_gradings() # print(gradings) - grades = await gimsis.fetch_grades(year="2023") + grades = await gimsis.fetch_grades(year="2022") print(grades) #profile = await gimsis.my_profile() #print(profile)