decided to add season support

This commit is contained in:
Sriram Hariharan
2023-03-04 23:00:01 -06:00
parent bc464cd264
commit d9739cdb56
3 changed files with 99 additions and 1 deletions

View File

@@ -60,8 +60,18 @@ export class CourseScraper {
fullName = fullName.replace(/\s\s+/g, ' ').trim();
const [courseName, department, number] = this.separateCourseName(fullName);
const [status, isReserved] = this.getStatus(row);
// TODO: get semester from somewhere
const year = new Date().getFullYear();
const month = new Date().getMonth();
let season = 'Fall';
if (month >= 0 && month < 5) {
season = 'Spring';
} else if (month >= 5 && month < 8) {
season = 'Summer';
}
const newCourse = new Course({
fullName,
courseName,
@@ -77,6 +87,11 @@ export class CourseScraper {
instructionMode: this.getInstructionMode(row),
instructors: this.getInstructors(row),
description: this.getDescription(document),
// TODO: get semester from somewhere
semester: {
year,
season,
},
});
courses.push({
rowElement: row,