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

Commits on May 8, 2024

  1. Improve conversion between total_points and grades

    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.
    Jonas-July authored May 8, 2024
    Configuration menu
    Copy the full SHA
    2c2b490 View commit details
    Browse the repository at this point in the history
  2. Fortify grade conversion

    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.
    Jonas-July authored May 8, 2024
    Configuration menu
    Copy the full SHA
    3cab755 View commit details
    Browse the repository at this point in the history