Skip to content

FAC-WEB fix: students see enrollments from all semesters (scope /enrollments/me to current term) #156

Description

@y4nder

Problem

After we backfill S12526 alongside S22526 (tracked by FAC-146 in api.faculytics), students who were enrolled in both semesters will see every enrollment in the Student Courses page. The UI copy says "you are currently enrolled in N courses this semester" but there is nothing enforcing that — GET /api/v1/enrollments/me returns every row where isActive=true, with no semester dimension.

Roles affected: Student only. Faculty/Dean/Chairperson/Campus Head already have a semester switcher and are unaffected.

Desired behaviour

  • Students: only see enrollments from the academic term that is currently in progress. No semester switcher exposed.
  • Faculty / Dean / Chairperson / Campus Head: unchanged — they keep their existing switcher and can view any historical semester.

Where it shows up

  • app/(dashboard)/student/courses/page.tsx — lists useMyEnrollments({ page, limit }) results without filtering.
  • Any future flow that consumes useMyEnrollments / fetchMyEnrollments for a student actor.

Implementation notes

The fix is primarily backend, with frontend verification. The work lands in api.faculytics and is consumed here.

Backend change (api.faculytics)

Add an optional semesterId query param to GET /api/v1/enrollments/me and resolve a default when it's omitted.

Recommended resolution strategy (Option B from the FAC-146 scouting): default to the Semester row where start_date <= now() < COALESCE(end_date, 'infinity'), scoped to the student's campus. This matches the natural notion of "the term that is currently in progress" and needs no admin flag to flip between terms — it self-corrects based on calendar dates we already populate via FAC-146.

Alternatives considered:

  • A: Derive from the student's most recent active enrollment. Brittle if a student has a gap semester.
  • C: Add an explicit isActive flag on Semester. Requires an admin action on every term transition; easy to forget.

Frontend verification (this repo)

  • Confirm the courses page still renders correctly when the API returns only current-term rows.
  • Confirm the "N courses this semester" copy is finally truthful.
  • Consider surfacing the resolved semester label (e.g. "Semester 2, AY 2025-2026") in the page header so the student has context.
  • No new switcher for students.

Test plan

  • Seed a student with enrollments in S22526 AND S12526.
  • Verify GET /enrollments/me (no query params) returns only S22526 rows during the S22526 window.
  • Verify the student courses page shows only those rows.
  • Verify the student cannot override via ?semesterId=<past> (or explicitly allow it — decide during refinement).
  • Verify Faculty/Dean/Chairperson/Campus Head dashboards are unaffected.

Dependency

This follow-up is unblocked by the FAC-146 PR (api.faculytics#383), which introduces Semester.startDate / Semester.endDate — the columns we need to resolve the current term.

Out of scope

  • TieredPipelineSchedulerJob still uses QuestionnaireSubmission.createdAt for "new submissions" detection — tracked separately.
  • Historical view for students (if we ever decide they should be able to view past semester evaluations) — intentionally not in scope here.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions