Skip to content

feat(peer-progress): Peer anonymized data fetch#619

Open
mudith-perera wants to merge 1 commit into
doubtfire-lms:10.0.xfrom
mudith-perera:Feature/Peer-Progress-Anonymization-API
Open

feat(peer-progress): Peer anonymized data fetch#619
mudith-perera wants to merge 1 commit into
doubtfire-lms:10.0.xfrom
mudith-perera:Feature/Peer-Progress-Anonymization-API

Conversation

@mudith-perera
Copy link
Copy Markdown

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

  • Test: env RAILS_ENV=test bundle exec ruby -Itest test/api/projects_api_test.rb
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if appropriate
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have created or extended unit tests to address my new additions
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

If you have any questions, please contact @macite or @jakerenzella.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant