Skip to content

Commit

Permalink
Merge pull request #349 from senior-knights/feature/update-scheduling…
Browse files Browse the repository at this point in the history
…-format

Feature/update scheduling format
  • Loading branch information
NycoCC1993 authored Apr 9, 2024
2 parents 506783f + 9d31bdc commit 6f61efc
Show file tree
Hide file tree
Showing 18 changed files with 1,547 additions and 162 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ jobs:
working-directory: ./client-course-schedulizer
strategy:
matrix:
node-version: [14.x]
node-version: [20.x]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Packages
run: npm install
run: pnpm install
working-directory: ${{env.working-directory}}
- name: Build Page
run: npm run build
run: pnpm run build
working-directory: ${{env.working-directory}}
- name: Remove gh-pages Cache
run: rm -rf node_modules/gh-pages/.cache
Expand Down

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions client-course-schedulizer/csv/Course_Section_Enrollment_Report.csv

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

144 changes: 144 additions & 0 deletions client-course-schedulizer/csv/full_schedule_2022.csv

Large diffs are not rendered by default.

194 changes: 194 additions & 0 deletions client-course-schedulizer/csv/full_schedule_2023.csv

Large diffs are not rendered by default.

Large diffs are not rendered by default.

200 changes: 200 additions & 0 deletions client-course-schedulizer/csv/full_schedule_2024.csv

Large diffs are not rendered by default.

109 changes: 75 additions & 34 deletions client-course-schedulizer/src/utilities/helpers/caseFunctions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { cloneDeep, forEach } from "lodash";
import moment from "moment";
import { Case } from "runtypes";
import { emptyMeeting } from "utilities/constants";
import { Course, Day, Meeting, Section, SemesterLength, Term } from "utilities/interfaces";

Expand Down Expand Up @@ -53,15 +54,58 @@ const assignWithMeetings = (
});
};

export const meetingPatternCallback = (value: string, params: CaseCallbackParams) => {
const patternParts = value.split("\n");
var meetingDays = "";
var times = "";

patternParts.forEach((element) => {
if (element.length > 1) {
meetingDays += element.split("|")[0].trimEnd() + "\n";
const timeParts = element.split(" ");
const time = timeParts[2] + timeParts[3] + " - " + timeParts[5] + timeParts[6] + "\n";
times += time;
}
});

daysCallback(meetingDays, params);
timeCallback(times, params);
};

export const daysCallback = (value: string, params: CaseCallbackParams) => {
assignWithMeetings(value, params, (days, i, meetings) => {
meetings[i].days = daysCase(days);
});
};

export const timeCallback = (value: string, params: CaseCallbackParams) => {
const timeParts = value.split("\n");
var startTimes = "";

timeParts.forEach((time) => {
const startTime = time.split(" ").join("").split("-")[0];
startTimes += startTime + "\n";
})

startTimeCallback(startTimes, params);
durationCallback(value, params);
};

export const startTimeCallback = (value: string, params: CaseCallbackParams) => {
assignWithMeetings(value, params, (startTime, i, meetings) => {
meetings[i].startTime = startTimeCase(startTime);
});
};

export const durationCallback = (value: string, params: CaseCallbackParams) => {
assignWithMeetings(value, params, (duration, i, meetings) => {
meetings[i].duration = durationCase(duration);
});
};

export const locationCallback = (value: string, params: CaseCallbackParams) => {
assignWithMeetings(value, params, (location, i, meetings) => {
[meetings[i].location.building, meetings[i].location.roomNumber] = locationCase(location);
[meetings[i].location.building, meetings[i].location.roomNumber] = locationCase(location.split("-")[0]);
});
};

Expand All @@ -88,16 +132,21 @@ export const semesterLengthCallback = (value: string, { section }: CaseCallbackP
section.semesterLength = semesterLengthCase(value);
};

export const daysCallback = (value: string, params: CaseCallbackParams) => {
assignWithMeetings(value, params, (days, i, meetings) => {
meetings[i].days = daysCase(days);
});
};

export const instructorCallback = (value: string, { section }: CaseCallbackParams) => {
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) => {
section.letter = value.split("-")[1];
course.name = value.split("-")[2];
}

export const prefixCallback = (value: string, { course }: CaseCallbackParams) => {
course.prefixes = value === "" ? [] : prefixCase(value);
};
Expand All @@ -114,13 +163,13 @@ export const letterCallback = (value: string, { section }: CaseCallbackParams) =
section.letter = value;
};

export const globalMaxCallback = (value: string, { section }: CaseCallbackParams) => {
section.globalMax = integerDefaultZeroCase(value);
};
// export const globalMaxCallback = (value: string, { section }: CaseCallbackParams) => {
// section.globalMax = integerDefaultZeroCase(value);
// };

export const localMaxCallback = (value: string, { section }: CaseCallbackParams) => {
section.localMax = integerDefaultZeroCase(value);
};
// export const localMaxCallback = (value: string, { section }: CaseCallbackParams) => {
// section.localMax = integerDefaultZeroCase(value);
// };

export const anticipatedSizeCallback = (value: string, { section }: CaseCallbackParams) => {
section.anticipatedSize = integerDefaultZeroCase(value);
Expand All @@ -136,6 +185,11 @@ export const yearCallback = (value: string, { section }: CaseCallbackParams) =>
section.year = yearCase(value);
};

export const semesterHourCallback = (value: string, params: CaseCallbackParams) => {
studentHoursCallback(value, params);
facultyHoursCallback(value, params);
}

export const studentHoursCallback = (value: string, { section }: CaseCallbackParams) => {
// Remove '$' is Excel prepended it to the student hours
section.studentHours = value.startsWith("$") ? Number(value.substr(1)) : Number(value);
Expand All @@ -145,12 +199,6 @@ export const facultyHoursCallback = (value: string, { section }: CaseCallbackPar
section.facultyHours = value.startsWith("$") ? Number(value.substr(1)) : Number(value);
};

export const durationCallback = (value: string, params: CaseCallbackParams) => {
assignWithMeetings(value, params, (duration, i, meetings) => {
meetings[i].duration = durationCase(duration);
});
};

export const roomCapacityCallback = (value: string, params: CaseCallbackParams) => {
assignWithMeetings(value, params, (capacity, i, meetings) => {
meetings[i].location.roomCapacity =
Expand All @@ -166,13 +214,13 @@ export const termStartCallback = (value: string, { section }: CaseCallbackParams
section.termStart = value;
};

export const usedCallback = (value: string, { section }: CaseCallbackParams) => {
section.used = integerDefaultZeroCase(value);
};
// export const usedCallback = (value: string, { section }: CaseCallbackParams) => {
// section.used = integerDefaultZeroCase(value);
// };

export const day10UsedCallback = (value: string, { section }: CaseCallbackParams) => {
section.day10Used = integerDefaultZeroCase(value);
};
// export const day10UsedCallback = (value: string, { section }: CaseCallbackParams) => {
// section.day10Used = integerDefaultZeroCase(value);
// };

export const startDateCallback = (value: string, { section }: CaseCallbackParams) => {
if (value.trim() !== "") {
Expand Down Expand Up @@ -207,7 +255,6 @@ export const groupCallback = (value: string, { section }: CaseCallbackParams) =>
section.group = value;
};


export const sectionCallback = (value: string, params: CaseCallbackParams) => {
if (value === "--" || value.trim() === "") {
params.section.isNonTeaching = true;
Expand All @@ -219,12 +266,6 @@ export const sectionCallback = (value: string, params: CaseCallbackParams) => {
}
};

export const timeCallback = (value: string, params: CaseCallbackParams) => {
const [startTime] = value.split(" ").join("").split("-");
startTimeCallback(startTime, params);
durationCallback(value, params);
};

export const nonTeachingActivityCallback = (value: string, params: CaseCallbackParams) => {
params.section.isNonTeaching = true;
instructionalMethodCallback(value, params);
Expand Down Expand Up @@ -337,8 +378,8 @@ export const endDateCase = (
value: string,
startSectionDate: string | undefined,
): SemesterLength => {
const sectionStart = moment(startSectionDate, "l");
const sectionEnd = moment(value, "l");
const sectionStart = moment(startSectionDate);
const sectionEnd = moment(value);
const sectionLength = sectionEnd.diff(sectionStart, "days");
const startMonth = sectionStart.month();
const firstStartMonths = [0, 1, 7, 8]; // Jan, Feb, Aug, Sept
Expand Down
31 changes: 18 additions & 13 deletions client-course-schedulizer/src/utilities/helpers/readCSV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const pruimSpreadsheetFields: ValidFields = {
days: cf.daysCallback,
duration: cf.durationCallback,
facultyHours: cf.facultyHoursCallback,
globalMax: cf.globalMaxCallback,
// globalMax: cf.globalMaxCallback,
half: cf.semesterLengthCallback,
instructor: cf.instructorCallback,
instructors: cf.instructorCallback,
localMax: cf.localMaxCallback,
// localMax: cf.localMaxCallback,
location: cf.locationCallback,
name: cf.nameCallback,
number: cf.numberCallback,
Expand All @@ -45,36 +45,41 @@ const pruimSpreadsheetFields: ValidFields = {
};

const registrarSpreadsheetFields: ValidFields = {
AcademicPeriod: cf.termCallback,
AcademicYear: cf.yearCallback,
BuildingAndRoom: cf.locationCallback,
Comments: cf.commentsCallback,
Course: cf.courseCallback,
CourseNum: cf.numberCallback,
Day10Used: cf.day10UsedCallback,
CourseSection: cf.courseSectionCallback,
// Day10Used: cf.day10UsedCallback,
DeliveryMode: cf.deliveryModeCallback,
Department: cf.departmentCallback,
Faculty: cf.instructorCallback,
EndDate: cf.endDateCallback,
FacultyLoad: cf.facultyHoursCallback,
GlobalMax: cf.globalMaxCallback,
// GlobalMax: cf.globalMaxCallback,
Group: cf.groupCallback,
InstructionalMethod: cf.instructionalMethodCallback,
InstructionalFormat: cf.instructionalMethodCallback,
Instructors: cf.instructorCallback,
LastEditTimestamp: cf.timestampCallback,
LocalMax: cf.localMaxCallback,
Location1: cf.locationCallback,
// Location2: cf.locationCallback,
// LocalMax: cf.localMaxCallback,
MeetingDays: cf.daysCallback,
MeetingDurationMinutes: cf.durationCallback,
MeetingPatterns: cf.meetingPatternCallback,
MeetingStart: cf.startTimeCallback,
MeetingTime: cf.timeCallback,
MinimumCredits: cf.studentHoursCallback,
RoomCapacity: cf.roomCapacityCallback,
SectionCode: cf.letterCallback,
SectionEndDate: cf.endDateCallback,
SectionStartDate: cf.startDateCallback,
SectionStatus: cf.statusCallback,
SemesterHours: cf.semesterHourCallback,
SemesterLength: cf.semesterLengthCallback,
ShortTitle: cf.nameCallback,
// StartDate: cf.termStartCallback,
StartDate: cf.startDateCallback,
SubjectCode: cf.prefixCallback,
Term: cf.termCallback,
TermStart: cf.termStartCallback,
Used: cf.usedCallback,
// Used: cf.usedCallback,
};

const templateSpreadsheetFields: ValidFields = {
Expand Down
Loading

0 comments on commit 6f61efc

Please sign in to comment.