From d1a5d8cba946ef3f93d4be3c28f790dcaf9bfd94 Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Tue, 26 Nov 2019 21:44:35 +0100 Subject: [PATCH] [APIv2/Vulcan] Fix start time in events. --- .../edziennik/api/v2/vulcan/data/api/VulcanApiEvents.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiEvents.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiEvents.kt index bcd02b6a..b0e65ba9 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiEvents.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiEvents.kt @@ -53,10 +53,11 @@ class VulcanApiEvents(override val data: DataVulcan, private val isHomework: Boo val eventDate = Date.fromY_m_d(event.getString("DataTekst") ?: return@forEach) val subjectId = event.getLong("IdPrzedmiot") ?: -1 val teacherId = event.getLong("IdPracownik") ?: -1 - val startTime = data.lessonList.singleOrNull { - it.weekDay == eventDate.weekDay && it.subjectId == subjectId - }?.startTime val topic = event.getString("Opis") ?: "" + + val lessonList = data.db.timetableDao().getForDateNow(profileId, eventDate) + val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime + val type = when (isHomework) { true -> Event.TYPE_HOMEWORK else -> when (event.getBoolean("Rodzaj")) {