feat(peer-progress): Peer anonymized data fetch#619
Open
mudith-perera wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
A new backend endpoint was added to support the Peer Progress feature: GET /api/projects/:id/peer_progress. The implementation is in projects_api.rb (line 41).
This endpoint uses the current project ID to find the student’s project, then uses that project’s unit to retrieve all active projects enrolled in the same unit. That means the peer data is matched through the unit the student belongs to, rather than by manually passing a unit code like COS100001 from the frontend.
The endpoint preserves student privacy by returning anonymized peer records only. Instead of exposing names or personal details, each student is returned as an alias such as Peer 01, Peer 02, and so on. The API also identifies which record belongs to the current student through an is_current_student flag.
Each peer’s progress is calculated from the existing task_stats stored on the project, specifically the order_scale value. That value is converted into a percentage and clamped between 0 and 100. A simple progress band is also assigned for display purposes:
Leading
On Track
Building
Needs Support
The endpoint includes an authorization check before returning data. A user must already have access to the requested project; otherwise the API responds with 403. This keeps the feature aligned with existing project access rules while still allowing real unit-based peer progress to be shown safely.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist:
If you have any questions, please contact @macite or @jakerenzella.