Skip to content

Commit

Permalink
fix: πŸ› Felaktig sortering av lektioner (kolplattformen#595)
Browse files Browse the repository at this point in the history
* fix: πŸ› incorrect sorting of lessons in timetable

βœ… Closes: kolplattformen#591

* fix: πŸ› end time when overlapping lessons

* style: πŸ’„ lint
  • Loading branch information
kajetan-kazimierczak authored Dec 10, 2021
1 parent 69e21ac commit ed3a27b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions apps/skolplattformen-app/components/daySummary.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const DaySummary = ({

const lessons = weekLessons
.filter((lesson) => lesson.dayOfWeek === currentDate.isoWeekday())
.sort((a, b) => a.dateStart.localeCompare(b.dateStart))
.sort((a, b) => a.timeStart.localeCompare(b.timeStart))

if (lessons.length <= 0) {
return null
Expand Down Expand Up @@ -62,7 +62,9 @@ export const DaySummary = ({
{translate('schedule.end')}
</Text>
<Text category="h5">
{lessons[lessons.length - 1].timeEnd.slice(0, 5)}
{lessons
.sort((a, b) => a.timeEnd.localeCompare(b.timeEnd))
[lessons.length - 1].timeEnd.slice(0, 5)}
</Text>
</View>
</View>
Expand Down
2 changes: 1 addition & 1 deletion apps/skolplattformen-app/components/week.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const Week = ({ child }: WeekProps) => {
lunch={menu[index] || {}}
lessons={lessons
.filter((lesson) => days[lesson.dayOfWeek - 1] === weekDay)
.sort((a, b) => a.dateStart.localeCompare(b.dateStart))}
.sort((a, b) => a.timeStart.localeCompare(b.timeStart))}
/>
))}
</ViewPager>
Expand Down

0 comments on commit ed3a27b

Please sign in to comment.