From 59fcb0a050a4d36c659a0c674ebb077b07e45d19 Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Sat, 23 Nov 2019 22:40:20 +0100 Subject: [PATCH] [APIv2/Timetable] Add lesson change metadata only when the lesson is today or in the future --- .../api/v2/idziennik/data/web/IdziennikWebTimetable.kt | 2 +- .../edziennik/api/v2/librus/data/api/LibrusApiTimetables.kt | 2 +- .../api/v2/mobidziennik/data/api/MobidziennikApiTimetable.kt | 4 ++-- .../edziennik/api/v2/vulcan/data/api/VulcanApiTimetable.kt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/idziennik/data/web/IdziennikWebTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/idziennik/data/web/IdziennikWebTimetable.kt index 4bff77e8..f6ee8b6e 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/idziennik/data/web/IdziennikWebTimetable.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/idziennik/data/web/IdziennikWebTimetable.kt @@ -153,7 +153,7 @@ class IdziennikWebTimetable(override val data: DataIdziennik, dates.add(lessonDate.value) lessons.add(lessonObject) - if (lessonObject.type != Lesson.TYPE_NORMAL) { + if (lessonObject.type != Lesson.TYPE_NORMAL && lessonDate >= Date.getToday()) { data.metadataList.add(Metadata( profileId, Metadata.TYPE_LESSON_CHANGE, diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/api/LibrusApiTimetables.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/api/LibrusApiTimetables.kt index f8cb37a8..e8d7991f 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/api/LibrusApiTimetables.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/api/LibrusApiTimetables.kt @@ -184,7 +184,7 @@ class LibrusApiTimetables(override val data: DataLibrus, } } - if (lessonObject.type != Lesson.TYPE_NORMAL) { + if (lessonObject.type != Lesson.TYPE_NORMAL && lessonDate >= Date.getToday()) { data.metadataList.add( Metadata( data.profileId, diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/mobidziennik/data/api/MobidziennikApiTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/mobidziennik/data/api/MobidziennikApiTimetable.kt index e022bdf8..68330cb4 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/mobidziennik/data/api/MobidziennikApiTimetable.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/mobidziennik/data/api/MobidziennikApiTimetable.kt @@ -75,7 +75,7 @@ class MobidziennikApiTimetable(val data: DataMobidziennik, rows: List) { } } - if (it.type != Lesson.TYPE_NORMAL) { + if (it.type != Lesson.TYPE_NORMAL && date >= Date.getToday()) { data.metadataList.add( Metadata( data.profileId, @@ -195,4 +195,4 @@ class MobidziennikApiTimetable(val data: DataMobidziennik, rows: List) { } }*/ } -} \ No newline at end of file +} 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 18c2c4d0..5f5f72b2 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 @@ -172,7 +172,7 @@ class VulcanApiTimetable(override val data: DataVulcan, val onSuccess: () -> Uni } } - if (type != Lesson.TYPE_NORMAL) { + if (type != Lesson.TYPE_NORMAL && lessonDate >= Date.getToday()) { data.metadataList.add(Metadata( profileId, Metadata.TYPE_LESSON_CHANGE,