Skip to content

Shravya Phase4 Class Performance Report#1942

Open
ShravyaKudlu wants to merge 5 commits into
developmentfrom
Phase4/Class-Wide/Performance_Report_Generation
Open

Shravya Phase4 Class Performance Report#1942
ShravyaKudlu wants to merge 5 commits into
developmentfrom
Phase4/Class-Wide/Performance_Report_Generation

Conversation

@ShravyaKudlu

@ShravyaKudlu ShravyaKudlu commented Dec 6, 2025

Copy link
Copy Markdown
Contributor

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
image

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:

  1. Average completion rate per topic.
  2. Distribution of performance levels (e.g., % Excellent / Satisfactory / Needs Improvement).
  3. Comparative analytics between students.
  4. Support filtering by subject, time range, or educator.

How to test:

  1. check into current branch
  2. do npm install and ... to run this PR locally
  3. Clear site data/cache
  4. log as admin user
  5. Endpoint: GET /educator/reports/class/:classId
  6. Verify the functionality

Screenshots or videos of changes:

image

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.

@ShravyaKudlu ShravyaKudlu marked this pull request as ready for review December 12, 2025 23:46
@ShravyaKudlu ShravyaKudlu changed the title Shravya - phase4 - Class Performance Report Shravya - Phase4 - Class Performance Report Dec 12, 2025
@ShravyaKudlu ShravyaKudlu changed the title Shravya - Phase4 - Class Performance Report Shravya Phase4 Class Performance Report May 1, 2026
@sonarqubecloud

sonarqubecloud Bot commented May 1, 2026

Copy link
Copy Markdown

@ShravyaKudlu ShravyaKudlu added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label May 2, 2026
@ShravyaKudlu ShravyaKudlu requested a review from SwathiAngadi May 31, 2026 06:12

@DeepighaJ DeepighaJ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked out to current branch and tested PR in Postman
Getting error when tried to hit the endpoint /educator/reports/class

Image

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/:classId route 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.

Comment thread src/startup/routes.js
app.use('/api', materialCostRouter);

app.use('/api/educator/reports', studentReportRouter());
app.use('/api/educator/report', studentReportRouter());
Comment thread src/startup/routes.js
app.use('/api/education', browsableLessonPlanRouter);

app.use('/api/educator/reports', downloadReportRouter);
app.use('/api/educator/reportdownload', downloadReportRouter);
Comment thread src/startup/routes.js
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) => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants