From 1b1fb092119641ce94195b850536e96bf884a625 Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Sun, 24 Nov 2019 16:31:51 +0100 Subject: [PATCH] [APIv2/Vulcan] Fix problems with week start in timetable. --- .../api/v2/vulcan/data/api/VulcanApiTimetable.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiTimetable.kt index 0ece5b64..882f6e59 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiTimetable.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiTimetable.kt @@ -29,14 +29,14 @@ class VulcanApiTimetable(override val data: DataVulcan, val onSuccess: () -> Uni init { data.profile?.also { profile -> val currentWeekStart = Week.getWeekStart() + + if (Date.getToday().weekDay > 4) { + currentWeekStart.stepForward(0, 0, 7) + } + val getDate = data.arguments?.getString("weekStart") ?: currentWeekStart.stringY_m_d val weekStart = Date.fromY_m_d(getDate) - - if (Date.getToday().weekDay > 4 && weekStart == currentWeekStart) { - weekStart.stepForward(0, 0, 7) - } - val weekEnd = weekStart.clone().stepForward(0, 0, 6) apiGet(TAG, VULCAN_API_ENDPOINT_TIMETABLE, parameters = mapOf(