Skip to content

Linh - Student Evaluation Results Backend APIs#2108

Open
linh2020 wants to merge 5 commits intodevelopmentfrom
linh_student_eval_clean
Open

Linh - Student Evaluation Results Backend APIs#2108
linh2020 wants to merge 5 commits intodevelopmentfrom
linh_student_eval_clean

Conversation

@linh2020
Copy link
Copy Markdown
Contributor

@linh2020 linh2020 commented Mar 18, 2026

Description

This PR adds backend support for the Student Viewing Evaluation Results feature by implementing secure API endpoints for students to view their evaluation data and check for new results. It introduces reusable calculation logic for performance metrics, dynamic score aggregation, and notification tracking to enable students to access their academic progress seamlessly.

These APIs provide structured data for:

Overall evaluation summary (scores, performance levels, submission stats)
Category-wise breakdown of results
Detailed task-level results with submission status
Notification state for new/unread evaluation results
This work enables the frontend to consume consistent, server-side calculated evaluation insights instead of duplicating logic in the UI, ensuring secure access and real-time updates.

Implements:
(PHASE 4 - Backend Tasks-Student Viewing Evaluation Results)

Related PRs (if any):

Main Changes Explained

Main Changes Explained

• Added new models: Created studentEvaluation.js and evaluationTask.js for storing evaluation categories and task details, with proper schemas, indexes, and validation.
• Enhanced existing models: Updated notification.js to include type and metadata fields for evaluation-specific notifications, plus a new index for efficient querying. Modified userProfile.js to add lastEvaluationResultsViewedAt in the student education profile for tracking viewed timestamps.
• Added new service: Implemented studentEvaluationResultsService.js with reusable utilities for calculating performance colors, aggregating scores/stats (e.g., on-time/late submissions), validating students, and managing notifications.
• Updated routes: Modified educatorRouter.js to add the /evaluation-results/publish POST endpoint. Created studentEvaluationResultsRouter.js for the new GET endpoints (/student/evaluation-results and /student/evaluation-results/notifications). Registered the new router in startup/routes.js.
• Added testing and utilities: Included unit tests (educatorController.spec.js, studentEvaluationResultsController.spec.js, studentEvaluationResultsService.spec.js),
• Database logic: Ensured secure student identity validation, dynamic calculation of average scores and submission stats, and performance color mapping for visual indicators. On publishing, inserts/updates evaluation data and creates notification records.

How to Test

Check out this branch: linh_student_eval_clean
Run: npm install, npm run dev (or equivalent backend start command)
Clear site data/cache if needed.
Example checks:
• Publish Results (Educator): POST /api/educator/evaluation-results/publish → Returns 201 with published categories
• Get Evaluation Results (Student): GET /api/student/evaluation-results → Returns summary, categories, and task results
• Check Notifications (Student): GET /api/student/evaluation-results/notifications → Returns hasNewResults, unreadCount, etc.

Note:

- break down assignAtoms function to fix 165-line limit

- add publishEvaluationResults endpoint to educator router

- extend notification and userProfile models for evaluation tracking

- add studentEvaluationResultsRouter to app routes

- update package.json with seed script for evaluation data
@linh2020 linh2020 changed the title feat: add studentEvaluationResults endpoint to educator router Linh - Student Evaluation Results Backend APIs Mar 18, 2026
@sonarqubecloud
Copy link
Copy Markdown

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