Shravya Phase4 Class Performance Report#1942
Open
ShravyaKudlu wants to merge 5 commits into
Open
Conversation
|
DeepighaJ
requested changes
Jun 2, 2026
There was a problem hiding this comment.
Pull request overview
Adds a new backend endpoint for generating class-wide performance analytics by aggregating per-student progress/metrics, intended for educator-facing reporting.
Changes:
- Registers a new
/api/educator/reports/class/:classIdroute for class aggregation reports. - Introduces a new router that fetches class membership + per-student data and returns a class-level summary plus student summaries.
- Adds a controller to compute per-student and group performance scores/categories.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| src/startup/routes.js | Registers the new class reports router and changes report-related mount paths. |
| src/routes/classAgreegraterRouter.js | Implements the new class report endpoint and response shape. |
| src/controllers/ClassAggregation/classAggregationController.js | Adds score computation and aggregation helpers for class performance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| app.use('/api', materialCostRouter); | ||
|
|
||
| app.use('/api/educator/reports', studentReportRouter()); | ||
| app.use('/api/educator/report', studentReportRouter()); |
| app.use('/api/education', browsableLessonPlanRouter); | ||
|
|
||
| app.use('/api/educator/reports', downloadReportRouter); | ||
| app.use('/api/educator/reportdownload', downloadReportRouter); |
Comment on lines
+418
to
+419
| // Class Aggregation Reports | ||
| const classAggregationRouter = require('../routes/classAgreegraterRouter'); |
Comment on lines
+37
to
+38
| const { classId } = req.params; | ||
| const { db } = mongoose.connection; |
Comment on lines
+45
to
+62
| const studentIds = await getStudentsInClass(classId); | ||
|
|
||
| const students = await Promise.all( | ||
| studentIds.map(async (studentId) => { | ||
| const { profile, metrics } = await getStudentData(studentId); | ||
| const score = await computeStudentScore(studentId); | ||
|
|
||
| return { | ||
| studentId, | ||
| educator: profile?.educator, | ||
| progressSummary: profile?.progressSummary, | ||
| subjects: profile?.subjects, | ||
| metrics, | ||
| score, | ||
| performance: performanceCategory(score), | ||
| }; | ||
| }), | ||
| ); |
Comment on lines
+35
to
+48
| async function computeStudentScore(studentId) { | ||
| const profile = await getProfile(studentId); | ||
| const metrics = await getMetrics(studentId); | ||
|
|
||
| if (!profile || !metrics) return null; | ||
|
|
||
| const ps = profile.progressSummary; | ||
|
|
||
| const C = (ps.totalCompleted / ps.totalAtoms) * 100; | ||
| const A = metrics.averageScore; | ||
| const E = metrics.engagementRate; | ||
|
|
||
| return Wc * C + Wa * A + We * E; | ||
| } |
Comment on lines
+50
to
+54
| function performanceCategory(score) { | ||
| if (score >= 85) return 'Excellent'; | ||
| if (score >= 60) return 'Satisfactory'; | ||
| return 'Needs Improvement'; | ||
| } |
Comment on lines
+61
to
+63
|
|
||
| if (validScores.length === 0) return 0; | ||
| return validScores.reduce((a, b) => a + b, 0) / validScores.length; |
| } | ||
|
|
||
| // ---------------------- GET /educator/reports/class/:classId ---------------------- | ||
| router.get('/class/:classId', async (req, res) => { |
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
Implements # (WBS) phase 4 class performance report

Result:
Adds backend capability for generating aggregated class-level reports,
enabling educators and PMs to compare and visualize group-level performance trends.
740 Phase 4 – Class-Wide Performance Report Generation – Backend
Returns: class-level analytics including per-student summaries.
Implement aggregation queries using existing performance and activity datasets.
Ensure efficient data retrieval through pagination or caching for large classes.
Main changes explained:
Features:
Aggregate performance data for all students within a class or group.
Include metrics such as:
How to test:
npm installand...to run this PR locallyScreenshots or videos of changes:
Note:
For Now I have used the build in database and connected to my mongoDB schema and with my own DB name added
Please update mongoDB add your schema and test it.