kolplattformen / skolplattformen

The source code to the civic tech project Öppna Skolplattformen.
https://skolplattformen.org
Apache License 2.0
795 stars 176 forks source link

Hjärntorget - wrong ending time #591

Closed oskargotte closed 2 years ago

oskargotte commented 2 years ago

The ending time displayed on the child card is not correct on the Android app. In the example below there are in fact lesson ending later than 10.20. However, this might be to the incorrect sorting of lessons, see #590

Screenshot_20211208-121509_ppna Skolplattformen~2 Screenshot_20211208-121540_ppna Skolplattformen

kajetan-kazimierczak commented 2 years ago

Konstigt beteende här har jag lyckats återskapa med fakeData. Jag kan kika på den.

PhyxDevel commented 2 years ago

The lessons are sorted on date and not timeStart. const lessons = weekLessons .filter((lesson) => lesson.dayOfWeek === currentDate.isoWeekday()) .sort((a, b) => a.timeStart.localeCompare(b.timeStart)) in daySummary.component.tsx will solve it.

PhyxDevel commented 2 years ago

Also if there are overlapping lessons at the end of the day the end date should be calculated by the last endTime and not just the last lesson endTime: const endTime = lessons .sort((a, b) => a.timeEnd.localeCompare(b.timeEnd))[lessons.length - 1] .timeEnd.slice(0, 5) I can make a pr later tonight

oskargotte commented 2 years ago

The lessons are sorted on date and not timeStart. const lessons = weekLessons .filter((lesson) => lesson.dayOfWeek === currentDate.isoWeekday()) .sort((a, b) => a.timeStart.localeCompare(b.timeStart)) in daySummary.component.tsx will solve it.

Yes that's what I thought as well. And the same fix should go into week.component.tsx I guess?

kajetan-kazimierczak commented 2 years ago

I can make a pr later tonight

I can fix it. Already started