Describe the bug
In the LMS, an assessment attempt is graded "passed" against an absolute PassingScore instead of a percentage of the assessment's max score:
// lms-service/handlers/assessments.go:374
passed := totalScore >= assessment.PassingScore
Defaults are: MaxScore = 100, PassingScore = 70 (assessments.go:104-108). The endpoint lets callers set both (POST /api/v1/assessments / PUT). So:
- An assessment with
max_score = 200, passing_score = 70 (the default) → a candidate who scores 70/200 (35%) passes.
- An assessment with
max_score = 1000 and a passing threshold that should be 70% (700) instead passes at 70/1000 = 7%.
The declared passing_score is never normalized against max_score, so for any assessment where max_score != 100, the pass/fail outcome is effectively random relative to the intent.
Also worth noting: the maxScore used for reporting is recomputed server-side from answers (assessments.go:393) while totalScore is points summed from the answers map — with non-default weight scales the ratio drifts further.
Steps to reproduce
- Create an assessment with
{"max_score": 200, "passing_score": 70} (defaults preview: passing 70)
- Open
POST /api/v1/assessments/{id}/attempt start, submit answers summing to 70
- Attempt is
PASSED, despite 70/200 = 35%
Expected behavior
passed = totalScore / maxScore >= passingScore / maxScore (or store the threshold as a percentage/ratio).
Actual behavior
passed = totalScore >= passingScore — absolute comparison.
Files involved
services/lms-service/handlers/assessments.go:352-378 (grading)
services/lms-service/handlers/assessments.go:104-108 (defaults)
Suggested fix
Either compute the pass threshold from max score consistently, or store passing_percentage and grade as totalScore/maxScore >= passingPercentage/100. Happy to open a PR with a unit test for the 200-max/existential-35% case.
Environment
- docker compose, Go build, branch
main @ 4afc605
Describe the bug
In the LMS, an assessment attempt is graded "passed" against an absolute
PassingScoreinstead of a percentage of the assessment's max score:Defaults are:
MaxScore = 100,PassingScore = 70(assessments.go:104-108). The endpoint lets callers set both (POST /api/v1/assessments/ PUT). So:max_score = 200,passing_score = 70(the default) → a candidate who scores 70/200 (35%) passes.max_score = 1000and a passing threshold that should be 70% (700) instead passes at 70/1000 = 7%.The declared
passing_scoreis never normalized againstmax_score, so for any assessment wheremax_score != 100, the pass/fail outcome is effectively random relative to the intent.Also worth noting: the
maxScoreused for reporting is recomputed server-side from answers (assessments.go:393) whiletotalScoreispointssummed from the answers map — with non-default weight scales the ratio drifts further.Steps to reproduce
{"max_score": 200, "passing_score": 70}(defaults preview: passing 70)POST /api/v1/assessments/{id}/attemptstart, submit answers summing to 70PASSED, despite 70/200 = 35%Expected behavior
passed = totalScore / maxScore >= passingScore / maxScore(or store the threshold as a percentage/ratio).Actual behavior
passed = totalScore >= passingScore— absolute comparison.Files involved
services/lms-service/handlers/assessments.go:352-378(grading)services/lms-service/handlers/assessments.go:104-108(defaults)Suggested fix
Either compute the pass threshold from max score consistently, or store
passing_percentageand grade astotalScore/maxScore >= passingPercentage/100. Happy to open a PR with a unit test for the 200-max/existential-35% case.Environment
main@4afc605