Skip to content

Commit

Permalink
Split part of original courseSectionCallback() into courseCallback()
Browse files Browse the repository at this point in the history
to fix the error of "cannot read properties of undefined"
  • Loading branch information
SophiaSun18 committed Mar 11, 2024
1 parent 7d7cd72 commit bc2efe3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions client-course-schedulizer/src/utilities/helpers/caseFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@ export const instructorCallback = (value: string, { section }: CaseCallbackParam
section.instructors = instructorCase(value);
};

export const courseCallback = (value: string, { course }: CaseCallbackParams) => {
course.department = value.split(" ")[0];
course.prefixes = [value.split(" ")[0]];
course.number = value.split(" ")[1];
}

export const courseSectionCallback = (value: string, { course, section }: CaseCallbackParams) => {
var origin = value.split(" ");
course.department = origin[0];
course.prefixes = [origin[0]];
course.number = origin[1].split("-")[0];
section.letter = origin[1].split("-")[1];
course.name = origin.slice(3).join(" ");
section.letter = value.split("-")[1];
course.name = value.split("-")[2];
}

export const prefixCallback = (value: string, { course }: CaseCallbackParams) => {
Expand Down
1 change: 1 addition & 0 deletions client-course-schedulizer/src/utilities/helpers/readCSV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const registrarSpreadsheetFields: ValidFields = {
AcademicPeriod: cf.termCallback,
AcademicYear: cf.yearCallback,
Comments: cf.commentsCallback,
Course: cf.courseCallback,
CourseNum: cf.numberCallback,
CourseSection: cf.courseSectionCallback,
// Day10Used: cf.day10UsedCallback,
Expand Down

0 comments on commit bc2efe3

Please sign in to comment.