The Grades widget simply provided a place to store your assignments and their respective grades. There was no part of this widget that gave you up-to-date information regarding the total grade in a given course or your GPA on any level.
Solution
Add fields to all the models to keep track of a grade at each level.
Each assignment type has an average grade for all assignments in their grouping.
Each course has a weighted average of all the assignment types that also has a number of grade points based on the grade cutoffs
Each semester has a GPA associated with it based on the grade points of each course
The server has a route to calculate total GPA based on the number of hours in each semester and the GPA of each semester
The client interface sends requests to the server to update these values when anything relevant to that value changes. This was accomplished using useEffect React hooks. A simple boolean state was implemented to stop circular dependencies from causing infinite hook triggering.
Testing
This was tested by adding, editing, and removing assignments and seeing that all relevant values would change. These values were also stored in the database since they were present on page refresh as well.
Notes
Some of the math is UT specific. The number of hours of a course is deduced from the name of the course (first numerical character in the name). Also, the specific grade points associated with each letter grade is UT specific (although the UT standard is relatively common among most schools).
Problem
The Grades widget simply provided a place to store your assignments and their respective grades. There was no part of this widget that gave you up-to-date information regarding the total grade in a given course or your GPA on any level.
Solution
Add fields to all the models to keep track of a grade at each level.
The client interface sends requests to the server to update these values when anything relevant to that value changes. This was accomplished using
useEffect
React hooks. A simple boolean state was implemented to stop circular dependencies from causing infinite hook triggering.Testing
This was tested by adding, editing, and removing assignments and seeing that all relevant values would change. These values were also stored in the database since they were present on page refresh as well.
Notes
Some of the math is UT specific. The number of hours of a course is deduced from the name of the course (first numerical character in the name). Also, the specific grade points associated with each letter grade is UT specific (although the UT standard is relatively common among most schools).
Closes #51