Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: implement correct grouping for engineering liberal studies #962

Merged
merged 7 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 65 additions & 33 deletions src/data/colleges/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,40 @@ import {
import { AdvisorGroup } from '../../tools/advisors/types';
import { lastNameRange, lastNameRanges } from '../../tools/advisors/checkers';

const engineeringLiberalArtsDistributions: readonly string[] = [
'CA',
'HA',
'LA',
'LAD',
'KCM',
'SBA',
'FL',
'CE',
'ALC',
'SCD',
'HST',
'ETM',
'SSC',
'GLC',
];
const engineeringLiberalArtsGroups: Record<string, string[]> = {
ejcheng marked this conversation as resolved.
Show resolved Hide resolved
'Group 1': [
'CA-AAP',
Copy link
Member

Choose a reason for hiding this comment

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

Hmmm I'm not sure if it is strictly necessary to go and add in the content after the hyphen for all of these categories. hasCategory checks for a substring match, and all the CAs are in Group 1, all the HAs in Group 2 ... (they are disjoint sets) so such granularity might not be needed. @nidhi-mylavarapu not sure if you have any thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried the groups without the after-hyphen content and it didn't filter correctly...not sure if it's something else though?

Copy link
Member

Choose a reason for hiding this comment

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

Alright we can probably stick with just this then, I don't anticipate the categories changing much.

'CA-AG',
'CA-AS',
'CA-HE',
'LA-AAP',
'LA-AG',
'LA-AS',
'LAD-HE',
'ALC-AAP',
'ALC-AS',
'ALC-HA',
'SCD-AAP',
'SCD-AS',
'SCD-HA',
],
'Group 2': ['HA-AAP', 'HA-AG', 'HA-AS', 'HA-HE', 'HST-AAP', 'HST-AS', 'HST-HA'],
'Group 3': ['KCM-AAP', 'KCM-AG', 'KCM-AS', 'KCM-HE', 'ETM-AAP', 'ETM-AS', 'ETM-HA'],
'Group 4': [
'SBA-AAP',
'SBA-AG',
'SBA-AS',
'SBA-HE',
'SSC-AAP',
'SSC-AS',
'SSC-HA',
'GLC-AAP',
'GLC-AS',
'GLC-HA',
],
'Group 5': ['FL-AAP', 'FL-AG'],
'Group 6': ['CE-EN'],
};

const engineeringRequirements: readonly CollegeOrMajorRequirement[] = [
{
Expand Down Expand Up @@ -111,37 +129,51 @@ const engineeringRequirements: readonly CollegeOrMajorRequirement[] = [
'https://www.engineering.cornell.edu/students/undergraduate-students/advising/liberal-studies',
checker: [
(course: Course): boolean =>
engineeringLiberalArtsDistributions.some(
distribution => hasCategory(course, distribution) ?? false
Object.values(engineeringLiberalArtsGroups).some(group =>
ejcheng marked this conversation as resolved.
Show resolved Hide resolved
group.some(distribution => hasCategory(course, distribution) ?? false)
) || courseIsForeignLang(course),
],
fulfilledBy: 'courses',
perSlotMinCount: [6],
slotNames: ['Course'],
additionalRequirements: {
'Courses must be from 3 categories.': {
'Courses must be from 3 groups.': {
checker: [
(course: Course): boolean =>
(course.catalogDistr?.includes('LA') || course.catalogDistr?.includes('LAD')) ?? false,
...engineeringLiberalArtsDistributions
.filter(it => it !== 'LA' && it !== 'LAD')
.map(distribution => (course: Course): boolean =>
hasCategory(course, distribution) ?? false
engineeringLiberalArtsGroups['Group 1'].some(
ejcheng marked this conversation as resolved.
Show resolved Hide resolved
distribution => hasCategory(course, distribution) ?? false
),
(course: Course): boolean =>
engineeringLiberalArtsGroups['Group 2'].some(
distribution => hasCategory(course, distribution) ?? false
),
(course: Course): boolean =>
engineeringLiberalArtsGroups['Group 3'].some(
distribution => hasCategory(course, distribution) ?? false
),
(course: Course): boolean =>
engineeringLiberalArtsGroups['Group 4'].some(
distribution => hasCategory(course, distribution) ?? false
),
(course: Course): boolean =>
engineeringLiberalArtsGroups['Group 5'].some(
distribution => hasCategory(course, distribution) ?? false
),
(course: Course): boolean =>
engineeringLiberalArtsGroups['Group 6'].some(
distribution => hasCategory(course, distribution) ?? false
),
],
fulfilledBy: 'courses',
perSlotMinCount: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
slotNames: [
'LA',
...engineeringLiberalArtsDistributions.filter(it => it !== 'LA' && it !== 'LAD'),
],
perSlotMinCount: [1, 1, 1, 1, 1, 1],
slotNames: Object.keys(engineeringLiberalArtsGroups),
minNumberOfSlots: 3,
},
'Courses must have at least 18 credits.': {
checker: [
(course: Course): boolean =>
engineeringLiberalArtsDistributions.some(
distribution => hasCategory(course, distribution) ?? false
Object.values(engineeringLiberalArtsGroups).some(group =>
ejcheng marked this conversation as resolved.
Show resolved Hide resolved
group.some(distribution => hasCategory(course, distribution) ?? false)
) || courseIsForeignLang(course),
],
fulfilledBy: 'credits',
Expand All @@ -153,8 +185,8 @@ const engineeringRequirements: readonly CollegeOrMajorRequirement[] = [
const { catalogNbr } = course;
return (
!ifCodeMatch(catalogNbr, '1***') &&
(engineeringLiberalArtsDistributions.some(
category => hasCategory(course, category) ?? false
(Object.values(engineeringLiberalArtsGroups).some(group =>
group.some(distribution => hasCategory(course, distribution) ?? false)
) ||
courseIsForeignLang(course))
);
Expand Down
Loading
Loading