Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve grade conversion #140

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Jonas-July
Copy link
Collaborator

A more resilient conversion using bisect instead of modular arithmetic.

Additionally now shows people with e.g. 99.5 points as being close to the next higher grade (at 100).

Fixes #139

Jonas-July added 2 commits May 8, 2024 14:11
While the students are graded with points in 0.25 intervals,
the actual grades are non-linear and discrete. This requires
a conversion step.

Since the grading steps are known multiples of 10, a fast
approach is to calculate the lower bound and use that value
for the conversion table. While this operation is O(1), it is
fragile and error-prone due to the use of modular arithmetic
and the requirement to finally yield exact integers.

The grading boundaries create a nicely increasing list, so a more general approach is to bisect it and find the lower and upper bounds. It's theoretically a bit slower with O(log(n)), but the small size of the grading table means that there is no significant impact.
This approach also makes it trivially simple to calculate the necessary points to the next grade - adding an infinite sentinel ensures that there is always an upper bound that can't be reached, so people with a close to perfect grade don't get marked as close to the next higher grade.

The database has to ensure that the points are in the valid range.
Using -infinity instead of 0 for the lower bound ensures that negative
points don't crash the server. This is similar to previous behaviour.

If the points are close to 100, there is no reason not to show it as close
to the next grade; this was only neessary to workaround the
previous conversion which wasn't as flexible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Rundungsfehler beim Punkte berechnen
1 participant