Skip to content

fix: show missing section warnings on schedule load - #3

Open
ronaldw07 wants to merge 5 commits into
mainfrom
fix-missing-section-warnings-on-load
Open

fix: show missing section warnings on schedule load#3
ronaldw07 wants to merge 5 commits into
mainfrom
fix-missing-section-warnings-on-load

Conversation

@ronaldw07

@ronaldw07 ronaldw07 commented Jan 18, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes icssc#1399 - Show missing section warnings for saved courses on page load

When AntAlmanac loads and restores courses from fromScheduleSaveState, the app now detects and displays warnings for courses that are missing required sections (e.g., lab, discussion).

Changes

  • Added checkForMissingSections() method to AppStore that:
    • Groups courses by course ID (deptCode + courseNumber + term)
    • Compares required section types (from sectionTypes array) with enrolled section types
    • Identifies missing required sections
    • Displays a warning snackbar listing all affected courses
  • Integrated into schedule loading: Call checkForMissingSections() after successful schedule load in loadSchedule()
  • Extracted sectionTypeToName() utility function: Created a reusable utility to convert section type codes to readable names
  • Refactored getMissingSections.ts: Updated to use the shared utility function, eliminating code duplication

How It Works

The getCourseInfo API endpoint (called by fromScheduleSaveState) already returns the full sectionTypes array containing all available section types for a course. After a schedule loads successfully, checkForMissingSections() compares the required section types with the sections the user has enrolled in and displays warnings for any missing required sections.

Example Output

If a user has saved a schedule with only Lecture + Lab sections of a course that requires Lecture + Lab + Discussion, they'll see:

1 course is missing required sections:
COMPSCI 161 (2024 Fall): Missing Discussion

For multiple courses:

2 courses are missing required sections:
COMPSCI 161 (2024 Fall): Missing Discussion
PHYSICS 7C (2024 Fall): Missing Lab

Test plan

  • Load a saved schedule with courses missing required sections
  • Verify warning snackbar appears on page load
  • Verify warning message correctly identifies missing sections
  • Verify existing missing section warnings in the AddedCourses pane still work
  • Verify no warnings appear for courses with all required sections

When courses are restored from saved state on page load, missing section
warnings now appear for courses that require additional sections (e.g., lab,
discussion) that weren't saved.

Changes:
- Add checkForMissingSections() method to AppStore that detects and displays
  warnings for courses missing required sections
- Call checkForMissingSections() after successful schedule load
- Extract sectionTypeToName() utility function to eliminate code duplication
- Refactor getMissingSections.ts to use shared utility function

Fixes icssc#1399
When loading a saved schedule, getCourseInfo was called with specific
sectionCodes, causing WebSOC to return only those sections. This resulted
in incomplete sectionTypes arrays, which prevented missing section warnings
from appearing correctly.

Now fetches full course data for each unique course to get complete
sectionTypes, ensuring the MUI Alert warnings appear when sections are
missing.

Fixes icssc#1399
Instead of making individual WebSOC queries for each course, group
courses by (term, deptCode) and query all courses in a department
at once. This reduces the number of API calls significantly.
… warnings

When fetching complete sectionTypes on schedule load, the previous approach
queried all courses in a department which caused cross-department contamination
(e.g. PHYSICS 3A and SOC SCI 3A polluting MATH 3A sectionTypes with Lab).

Now queries each unique (term, deptCode, courseNumber) individually and filters
results to only match the correct department and course number.
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.

Show missing section warnings for saved courses on page load

1 participant