diff --git a/src/components/Calendar.tsx b/src/components/Calendar.tsx index ee859c2..4f6510a 100644 --- a/src/components/Calendar.tsx +++ b/src/components/Calendar.tsx @@ -189,7 +189,7 @@ const CalendarCourses = ({ courses: day }: { courses: WeekCourses }) => { gridRowStart: getGridRow(time.time.start), gridRowEnd: getGridRow(time.time.end), height: calcHoursDuration(time.time) * 6 + 'rem', - zIndex: 10 - j, // TODO: Remove zIndex after implementing course conflicts #5 + zIndex: j, // TODO: Remove zIndex after implementing course conflicts #5 }} > {time.courses.map((course) => ( diff --git a/src/helpers/calendar.ts b/src/helpers/calendar.ts index b94645e..76179df 100644 --- a/src/helpers/calendar.ts +++ b/src/helpers/calendar.ts @@ -99,7 +99,7 @@ export const getWeekCourses = ( // TODO: Remove this sorting after implementing course conflicts #5 courses.forEach((dayCourses) => { - // Sort by duration (shortest first) and start time (latest first) + // Sort by duration (longest first) and start time (earliest first) dayCourses.sort((a, b) => { const aStart = timeToDayjs(a.time.start); const aEnd = timeToDayjs(a.time.end); @@ -110,12 +110,12 @@ export const getWeekCourses = ( const bDuration = bEnd.diff(bStart, 'minute'); if (aDuration === bDuration) { - if (aStart.isBefore(bStart)) return 1; - if (aStart.isAfter(bStart)) return -1; + if (aStart.isBefore(bStart)) return -1; + if (aStart.isAfter(bStart)) return 1; return 0; } - return aDuration - bDuration; + return bDuration - aDuration; }); });