You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ECSoC26-L3Difficult, auto-assigned by Sentinel — 15 pointsECSoC26Required label for a PR to be eligible for Sentinel scoringgood-prPA-awarded bonus for an exceptionally executed PR — +15 XP
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the backend changes requested in Issue #39 to validate course-section completion and prevent duplicate progress entries.
Fixes #39
ECSoC26
This contribution is submitted under ECSoC26.
Problem
The previous course-completion flow manually appended section progress to an array.
That allowed:
Implementation
Course validation
The controller now:
courseIdandsectionIdare provided404when the course does not existCurrent section-ID compatibility
The current frontend submits a zero-based section index.
The backend continues to support that format:
The implementation also supports embedded section
_idoridvalues for future compatibility.Enrollment validation
The authenticated user must have an enrollment record for the requested course.
An unenrolled user receives a controlled
403response.Atomic duplicate prevention
Progress is now updated with a conditional MongoDB query and
$addToSet.The filter excludes records where the section is already complete:
The update uses:
This prevents repeated and concurrent requests from creating duplicate progress entries.
Idempotent response
A newly completed section returns:
{ "success": true, "alreadyCompleted": false, "message": "Section completed successfully" }A repeated request returns:
{ "success": true, "alreadyCompleted": true, "message": "Section was already completed" }Tests added
The backend tests cover:
$addToSetusageAcceptance criteria verification
courseIdandsectionIdare validatedVerification commands
Syntax checks
Test suite
Relevant code checks
Test evidence
Files changed