Repository navigation
Don't fail get_grades() on unknown or numeric grade types - #128
Merged
Merged
Conversation
EduPage can send p_typ_udalosti as a number, and it also uses grade types other than 1-3 (e.g. "4" for symbolic grades like "Ú"). Neither matched the if chain, so max_points was never assigned and get_grades() raised UnboundLocalError. Co-Authored-By: Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
get_grades()fails for some schools with:The
max_points/importancebranch only handlesp_typ_udalostivalues"1","2"and"3"as strings. Real data from a Czech primary school has two other shapes:"4": symbolic grades, e.g.Ú(p_vahais set,p_vaha_bodyisnull)1as a number instead of"1"Neither matches, so both variables are never assigned.
Fix
str(p_typ_udalosti), so a numeric type is handled like its string form.max_pointsandimportancetoNone.importancefromp_vahaif present. There are no max points, andpercentstaysNonebecause the grade isn't numeric.Tests
New
tests/test_grades.py: normal, numeric-type, percentage, symbolic ("4",Ú) and unknown types withoutp_vaha. The new symbolic, numeric and unknown cases fail onmaster, and the suite passes. Also checked against a real parent account: 12 grades load, 4 of them symbolic.Co-Authored-By: Claude Code