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

Inconsistent grade shown between course ruler and Student Progress page #266

Closed
egillespie opened this issue Apr 22, 2020 · 2 comments · Fixed by #286
Closed

Inconsistent grade shown between course ruler and Student Progress page #266

egillespie opened this issue Apr 22, 2020 · 2 comments · Fixed by #286
Assignees
Labels

Comments

@egillespie
Copy link
Collaborator

In some situations, students who have earned almost exactly 4.0 grade points in a course will have their actual grade points shown as 3.99 and rounded down to a 3.5 milestone. When this happens, the Student Progress page for an instructor may show a 4.0 for both the actual grade points and milestone achieved.

There appears to be some inconsistency with how grade points are determined and shown in these two places and it can be very confusing when a teacher tells a student "Congratulations on your 4.0" only to find that the student believes they had to complete (and perhaps even started) one more project.

Proposed solution:

Round the grade points earned for each lesson, then sum up all of the rounded earned grade points.

This will result in a grade point value that extends to 2 decimal places and is guaranteed to match the value that a human would determine by hand when adding the visible grade points of each completed lesson.

This solution should then be consistently used on both the course ruler and Student Progress page.

Recommended:

Create an end-to-end test that can reproduce this bug, then verify that the solution causes the test to pass so future regressions can be avoided.

@egillespie
Copy link
Collaborator Author

egillespie commented May 19, 2020

As discussed in this StackOverflow answer, there appears to be an issue in JavaScript where scaled rounding such as:

Math.round(1.005 * 100) / 100

Will produce an invalid result of 1 instead of 1.01. This issue was affecting the rounding of lessons with 0.095238 grade points and they were sometimes rounding incorrectly in aggregate and showing a resulting grade of 3.99 instead of 4.0.

The solution is an adaptation of the linked StackOverflow answer that allows rounding to more or fewer than 2 decimal places:

export default (number, digits = 2) => {
  const scale = Math.pow(10, digits)
  return Math.round((number + Number.EPSILON) * scale) / scale
}

Note: As a side-effect of fixing this issue, lessons with a 1-hour estimate on a 3 credit hour course will (correctly) show 0.1 grade points earned per lesson instead of the previously incorrect 0.09.

@egillespie
Copy link
Collaborator Author

Verified in staging, then deployed and verified in MSU and Code Lab 517 production environments..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant