Skip to content

Conversation

@calebwongg
Copy link
Contributor

Summary

Added a warning displaying the missing sections for a course on the added courses page.

When a user selects classes for a course, the required sections for a course are checked (e.g., lecture, lab, discussion) have been added. If any required section type is missing, the UI displays a warning so the user can correct their schedule.

Test Plan

  • Add SOME sections of a course to schedule, and check the added courses tab to verify there is a warning for whichever section is missing
  • Add all sections of a course to a schedule. In the added courses tab, ensure there are no warnings, and then delete one of the sections to verify a warning pops up. Add the section back to verify the warning disappears
  • Check error handling for users importing saved courses
  • Check UI on both light mode and dark mode

Issues

Closes #1330

Before

image

After

image

Future Followup

  • Could add an alert for if a user schedules two different sections in two different categories (e.g. the user schedules a lecture 'A' but a discussion 'B')

Notes

  • Missing sections are not checked for users who are importing courses that were saved to their profile (The only way to do it was to query websoc again when the user signs in). Hopefully should not be a problem since the scheduling period for next quarter is mostly over.

@calebwongg calebwongg changed the title Cwong/missing sections warning feat: Missing Sections Warning Dec 17, 2025
@calebwongg calebwongg marked this pull request as ready for review December 17, 2025 05:57
Copy link
Member

@KevinWu098 KevinWu098 left a comment

Choose a reason for hiding this comment

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

Some misc. comments — I'll take another look once they're addressed and once the merge conflicts with main are resolved


type AACourseExtendedProperties = {
sections: AASection[];
sectionTypes?: Set<WebsocSectionType>;
Copy link
Member

Choose a reason for hiding this comment

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

question: why is this field optional now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some AACourses that have not been enriched yet don't have the section types property if the user added/saved them to their schedule before this feature is merged. I made it optional to handle errors so the missing sections check doesn't try to check and access an attribute that doesn't exist

Comment on lines +62 to +67
const sectionTypes = new Set<WebsocSectionType>();
course.sections.forEach((section) => {
sectionTypes.add(section.sectionType);
});

(course as AACourse).sectionTypes = sectionTypes;
Copy link
Member

Choose a reason for hiding this comment

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

question: I see we have this bit of code in websoc.ts and here. why are there two instances of the same code snippet? what do they do / why do we need them both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This snippet of code is in the getCourseInfo endpoint which is called when a user adds courses via import. I couldn't figure out a way to use this code snippet only once - I had to use it again in the flattenSocObject func in the CourseRenderPane. The websoc query from the regular course search calls the getOne endpoint which just returns the raw websoc query data. The query from the imports calls the getCourseInfo endpoint, and I couldn't find an overlap to avoid this redundant code

Would love to hear if you have any alternate ideas on this implementation :D

@KevinWu098
Copy link
Member

Is this ready for review? @calebwongg

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.

Required sections missing warning

3 participants