Skip to content

Commit

Permalink
fix for weird classes
Browse files Browse the repository at this point in the history
  • Loading branch information
unkn-wn committed Dec 2, 2024
1 parent fb60efa commit 00230d6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ const MeetingDisplay = ({ meeting, isHighlighted, onHover }) => (

export const getCourseData = async (subjectCode, courseCode, title) => {
try {
// BANDAID FIX #1: Hardcode STAT 416 and STAT 519
console.log(subjectCode, courseCode);
if (subjectCode === 'STAT') {
if (courseCode === 41600 || courseCode === 51900) {
subjectCode = 'MA';
}
}

// HARD CODED SEMESTER
const semester = "202520";
const url = "https://api.purdue.io/odata/Courses?$expand=Classes($filter=Term/Code eq '" +
semester + "';$expand=Sections($expand=Meetings($expand=Instructors,Room($expand=Building))))" +
Expand All @@ -156,6 +165,7 @@ export const getCourseData = async (subjectCode, courseCode, title) => {
const response = await fetch(url);
const data = await response.json();

// BANDAID FIX #2: Filter out courses with the same title
if (data.value.length > 1) {
console.warn('Multiple courses found with the same title:', data.value);
data.value = data.value.filter(course => course.Title === title);
Expand Down

0 comments on commit 00230d6

Please sign in to comment.