EdupageAPI / edupage-api

A python library for accessing your Edupage account
https://edupageapi.github.io/edupage-api/
GNU General Public License v3.0
66 stars 13 forks source link

[Bug] Text grades are unsupported #71

Open TobaT3 opened 10 months ago

TobaT3 commented 10 months ago

Describe the bug When requesting grades, if the grade is not one of the three types in the code (eg. is not 1-5, points or percentages but for example text), max_points and possibly something else will be undefined.

Your code

allgrades = edupage.get_grades()

Error message

Traceback (most recent call last):
  File "/home/toba/Code/edupage-api-test/main.py", line 28, in <module>
    getGrades()
  File "/home/toba/Code/edupage-api-test/main.py", line 23, in getGrades
    allgrades = edupage.get_grades()
                ^^^^^^^^^^^^^^^^^^^^
  File "/home/toba/.local/lib/python3.11/site-packages/edupage_api/__init__.py", line 158, in get_grades
    return Grades(self).get_grades(year=None, term=None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toba/.local/lib/python3.11/site-packages/edupage_api/module.py", line 95, in __impl
    return method(self, *method_args, **method_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toba/.local/lib/python3.11/site-packages/edupage_api/grades.py", line 148, in get_grades
    subject_name, teacher, max_points, importance, verbal, percent)
                           ^^^^^^^^^^
UnboundLocalError: cannot access local variable 'max_points' where it is not associated with a value

Expected behavior A clear and concise description of what you expected to happen.

Version

ivanhrabcak commented 9 months ago

Could you try to put a breakpoint in the code and see what grade_type is the grade that is erroring out?

If you need help, I suggest we meetup in a call in my server.