Skip to content

Replace Grade class with Threshold table #6

Description

@scd31

We can create a Threshold table in the database that has a n:1 relationship with the Course table. This makes the code cleaner and DRYer. It also makes it possible to add courses with more or less letter grades than the ones specified in the code.

My proposal would be for the Threshold table to have the following attributes: (id: int, name: varchar, threshold: double, course_id: int, grade: double). Most of these are self explanatory, but the grade column is for the number that gets used to calculate GPA.

The following SQL could be used for a lookup:
SELECT grade FROM Threshold WHERE course_id = ? AND threshold <= ? ORDER BY grade DESC LIMIT 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions