diff --git a/client/src/components/schedule/Period.tsx b/client/src/components/schedule/Period.tsx index e49c1433..0db0a20d 100644 --- a/client/src/components/schedule/Period.tsx +++ b/client/src/components/schedule/Period.tsx @@ -53,7 +53,7 @@ export default function Period(props: PeriodProps) { <>

{id ? ( - + {name} ) : name} diff --git a/shared/util/schedule.ts b/shared/util/schedule.ts index 522117fb..0fafd9e2 100644 --- a/shared/util/schedule.ts +++ b/shared/util/schedule.ts @@ -7,13 +7,6 @@ import schedule, {SCHOOL_START, SCHOOL_END, SCHOOL_END_EXCLUSIVE, PeriodObj} fro // To account for duplicated weekday letters, Thursday is R and Saturday is A. export const numToWeekday = (num: number) => ['S', 'M', 'T', 'W', 'R', 'F', 'A'][num]; -// Account for how the weekly SELF/SH rotation aren't necessarily alternates -export function isAlternate(normal: PeriodObj[], alternate: PeriodObj[] | null) { - if (!alternate) return true - const selfShFilter = ({ n }: { n: PeriodObj["n"] }) => !['S', 'H'].includes(n); - return JSON.stringify(normal.filter(selfShFilter)) !== JSON.stringify(alternate.filter(selfShFilter)); -} - // Gets the Gunn schedule for a given `DateTime`, as an object {periods, alternate} representing the day's schedule // as a `PeriodObj[]` or null if there's no school and whether the schedule is an alternate. export function getSchedule(date: DateTime, alternates: Alternates['alternates']) { @@ -27,16 +20,14 @@ export function getSchedule(date: DateTime, alternates: Alternates['alternates'] let periods: PeriodObj[] | null; let alternate = false; - const normal = schedule[numToWeekday(localizedDate.weekday % 7)]; - // Check for alternate schedules if (altFormat in alternates) { // If viewDate exists in alt schedules, load that schedule periods = alternates[altFormat]; - alternate = isAlternate(normal, periods); + alternate = true; } else { // Otherwise, use default schedule - periods = normal; + periods = schedule[numToWeekday(localizedDate.weekday % 7)]; } return {periods, alternate};