Skip to content

feat(teacher-workflow): add multi-class student management, diagnostics, performance dashboard and evaluation reports - #74

Open
sreeja37 wants to merge 9 commits into
vicharanashala:mainfrom
sreeja37:feat/teacher-workflow-v2
Open

feat(teacher-workflow): add multi-class student management, diagnostics, performance dashboard and evaluation reports#74
sreeja37 wants to merge 9 commits into
vicharanashala:mainfrom
sreeja37:feat/teacher-workflow-v2

Conversation

@sreeja37

Copy link
Copy Markdown

Summary

This PR enhances the Teacher Workflow by replacing mock implementations with dynamic backend-driven functionality and improving student management, diagnostics, performance tracking, and evaluation reporting.

Features Implemented

Student Registration

  • Integrated newly registered students into the live application workflow.
  • Ensured newly created students are immediately reflected across all teacher-facing views.

Multi-Class & Multi-Section Support

  • Added dynamic Class and Section selection across teacher modules.
  • Removed assumptions of a single classroom.
  • Enabled seamless switching between multiple classes and sections.

Student List

  • Unified the student roster with the Teacher Dashboard.
  • Ensured Student List displays the same live data as other teacher views.
  • Resolved synchronization issues between the Dashboard and Student List.

Student Profile

  • Added Class and Section selectors.
  • Dynamically updates the student list based on the selected class and section.
  • Uses a shared student data source to maintain consistency across the application.

Editable Personal Details

  • Added Edit / Save / Cancel functionality.
  • Enabled editing of student personal information.
  • Added validation and backend persistence.
  • Ensured updates are reflected across all teacher-facing views.

Diagnostic Workflow

  • Integrated the diagnostic workflow with backend APIs.
  • Improved endpoint routing and workflow handling.
  • Replaced mock implementations with live backend integration.
  • Fixed issues related to worksheet generation and AI diagnostic flow.

Performance Dashboard

  • Added dynamic filtering by Class, Section, and Student.
  • Improved state synchronization.
  • Ensured performance data stays consistent with the selected student scope.

Evaluation Reports

  • Replaced mock reports with backend-driven Evaluation Reports.
  • Added dynamic filtering by Class, Section, and Student.
  • Implemented report aggregation and summary statistics.
  • Added defensive handling for empty or partial datasets.
  • Fixed runtime rendering and filtering issues.

Backend

  • Added the Evaluation Report module.
  • Implemented:
    • Controller
    • Service
    • Repository
    • Interface
    • Model
    • Routes
  • Registered Evaluation Report routes.
  • Extended student services and APIs to support the updated teacher workflow.

Frontend

  • Added the Evaluation Report service.
  • Added a React Query hook for Evaluation Reports.
  • Updated teacher panels to consume live backend data.
  • Improved state synchronization across Student Profile, Performance, Diagnostics, and Reports.
  • Removed remaining mock dependencies where applicable.

Verification

  • ✅ Frontend build successful.
  • ✅ Backend build successful.
  • ✅ Student Registration verified.
  • ✅ Multi-Class & Multi-Section workflow verified.
  • ✅ Student List verified.
  • ✅ Student Profile verified.
  • ✅ Personal Details editing verified.
  • ✅ Diagnostic workflow verified.
  • ✅ Performance Dashboard verified.
  • ✅ Evaluation Reports verified.

Mate added 9 commits July 18, 2026 03:45
Bug 6 (Student Profile mock fallback) and Bug 7 (class/section
selectors) were already landed on this branch in earlier sessions.
This commit bundles them with the new Edit Personal Details feature.

Backend:
- Add PATCH /api/students/:id (repo + service + controller + route).
- extend IStudent + Student schema with 11 optional personal/contact
  fields: dateOfBirth, gender, bloodGroup, disabilityStatus,
  guardianName, guardianRelation, contactNumber, residentialAddress,
  midDayMeal, busRoute, enrollmentDate.
- updateStudent: editable whitelist (12 fields), validation
  (name required, age 3-25, contact 7-15 digits, dob valid date),
  school-scope (superadmin bypass), 404 on miss, 400 on empty patch,
  role-based Aadhar masking at response edge (superadmin sees raw,
  others see XXXX-XXXX-1234).
- Extend IStudentProfile + GET /api/students/:id so the Dashboard
  View Profile modal surfaces the same fields the Student Profile
  page can edit.

Frontend:
- Student type extended with the 11 new optional fields.
- studentService: UpdateStudentPayload + updateStudent(id, payload).
- useUpdateStudent hook: useMutation + invalidateQueries([students])
  on success (same pattern as useCreateStudent). Every consumer of
  the [students] cache (Dashboard roster, Registration selector,
  Student List, Student Profile) auto-refreshes after a save.
- PanelViews.tsx Personal Information card: full Edit / Save / Cancel
  UI with inline validation, success/error toast, Loader2 spinner,
  disabled inputs during save, read-only fields preserved as a
  separate section (Aadhar, Class, Section, School, School ID).
- Diff-only payload: snapshot personalOriginal at Edit-click; send
  only keys whose draft value differs.
- Unsaved-changes guard: trySwitchStudent / trySwitchTab /
  trySwitchScope intercept navigation; confirmUnsavedSave /
  confirmUnsavedDiscard / cancelUnsavedPrompt handle the 3-way
  dialog.
- Migrate Quick Info, Additional Info, Guardian & Contact cards
  (and the enrollmentTimestamp calc) off the legacy
  profile = {} placeholder; remove the placeholder declaration.
- RoleDashboards.tsx StudentProfileModal: extend ProfileState type
  with the 9 new fields; add 9 new dt/dd rows using the existing
  renderValue / renderMissingChip pair; add caption noting the
  modal reflects the latest PATCH edits.

Verification:
- npx tsc --noEmit (frontend): 0 errors.
- npx tsc --noEmit (backend): only pre-existing errors (db.ts,
  paperGenerator.ts, student.service.ts:103/174 - not from this
  work).
- npm run build (frontend vite build): success.
- npm run build (backend esbuild): success.
- curl PATCH + GET round-trip: confirms all 9 new fields surface
  through GET /api/students/:id, list endpoint reflects changes,
  revert to null works, invalid input rejected (400/404).
Bug found in user verification: PATCH /api/students/:id persisted
gender fine, but the Dashboard "View Profile" modal still showed
"Not Available" because getStudentProfile() was hardcoding
"gender: null" (and "enrollmentDate: null") instead of reading
from the stored document.

The seeded-students comment from before Phase 3 (when neither
field was editable) became a real footgun once PATCH made gender
editable.

Fix: getStudentProfile() now reads student.gender ?? null, the
same pattern used for the Phase 3 personal / contact fields just
below it.

"enrollmentDate" is intentionally NOT yet changed because it is
not on the updateStudent whitelist and remains read-only. The
inline comment in the service explains how to fix it when that
field becomes editable.

Verified end-to-end via curl on s_AP_GNT_GNT_01_01_C2_03:
  GET before: gender "Female" (left over from prior session)
  PATCH gender=Female: 200, body.gender "Female"
  GET after Female: "Female"       (bug fixed)
  PATCH gender=Male: 200
  GET after Male: "Male"
  PATCH gender=null: 200, body.gender null
  GET after null: null             (revert works)

Backend tsc --noEmit unchanged (same 6 pre-existing errors,
none from this fix).

The Dashboard modal reads /api/students/:id via direct fetch
(not React Query), so the next modal open after a PATCH will
now show the freshly-saved gender value.
…tion/student)

Mirror the Student Profile's class+section selector pattern in the
Performance panel, and add a per-student focus dropdown so teachers can
drill from class-level aggregates into a single student's progress
without leaving the page.

Scope:
- New component-level state: perfScopeClassGroup, perfScopeSection,
  perfSelectedStudentId. Independent from the Student Profile scope so
  changing one doesn't disturb the other.
- Two new useEffects: one to snap perf scope to first available
  class+section when the roster arrives, and one to clear
  perfSelectedStudentId when the focused student falls out of scope.
- Performance panel rewritten end-to-end:
  - Filter row: Class + Section dropdowns (mirrors the existing
    profile-block selectors) + a Focus Student dropdown with an
    "Aggregate view (whole class)" no-focus option.
  - Metric cards react to the filtered scope: Students in Scope, Avg
    Level, Certified (L5+), Pending Diagnostic (with active/awaiting
    breakdown).
  - Per-student detail card when a student is focused: name + ID +
    Placed/Pending chip, target/streak, current level big-readout,
    progress bar to target level, recent level history (last 8 events,
    newest first).
  - Level Distribution histogram (L1..L4 + L5+) for the active scope.
  - Top Performers list (sorted by currentLevel, filtered to scope),
    click-to-focus on each row.
- Zero mock data, zero REPORTS_MOCK references in this panel — every
  field is derived from the live useStudents() roster.

Verification:
- npx tsc --noEmit frontend: 0 errors
- npx tsc --noEmit backend: 6 pre-existing errors only (db.ts,
  paperGenerator.ts, student.service.ts:103/174)
- npm run build: success in 16.07s (vite + esbuild)
- Live probe: 75 students across 5 classes/sections returned from
  GET /api/students; all carry levelHistory[], targetLevel, streak
- Brace balance: 103 opens / 103 closes in the perf block
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