Loading
Support the 4.0 grading scale
Closes #2 (closed)
What changed
src/gpa.js: added 4-point bands and degree classes, a strictvalidateScalehelper (only the numbers 4 and 5;undefineddefaults to 5), and an optionalscaleparameter ongradeFor,classOfDegreeandcomputeGpa. The responsescalenow echoes the scale used.src/server.js:POST /api/gpapassesbody.scalethrough. Invalid values return 400 viaValidationError.public/index.html: scale selector (5-point or 4-point). It sendsscalein the request and updates the subtitle and result text.- Tests added in
test/gpa.test.jsandtest/server.test.js.CHANGELOG.mdupdated.
Assumptions
- Existing class labels are kept ("Second Class Upper" and "Second Class Lower").
- A 4.0 GPA below 1.0 is labelled "Fail".
How it was tested
npm test: 22 tests pass, 97% line coverage (gpa.js at 100%).npx eslint@9 .: 0 errors.- Covered: 4.0 band and class boundaries, a computed 4.0 GPA, default-5 regression, and invalid scales (3, "4", null, 4.5) returning 400.
No new dependencies.
Opened by Relay Builder. Relay Shepherd is now watching the pipeline.