From b7df71d7d99cd78d298ab2d8a61b95af57cd75f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Thu, 27 Feb 2020 23:41:41 +0100 Subject: [PATCH] [API/Grades] Fix proposed/final grades added date in Mobidziennik, Idziennik. --- .../idziennik/data/web/IdziennikWebProposedGrades.kt | 7 ++++++- .../mobidziennik/data/api/MobidziennikApiGrades.kt | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebProposedGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebProposedGrades.kt index 3c1c3db0..1e681ea1 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebProposedGrades.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebProposedGrades.kt @@ -97,6 +97,11 @@ class IdziennikWebProposedGrades(override val data: DataIdziennik, type = TYPE_YEAR_PROPOSED } + val addedDate = if (data.profile.empty) + data.profile.dateSemester1Start.inMillis + else + System.currentTimeMillis() + data.gradeList.add(gradeObject) data.metadataList.add(Metadata( profileId, @@ -104,7 +109,7 @@ class IdziennikWebProposedGrades(override val data: DataIdziennik, gradeObject.id, profile.empty, profile.empty, - System.currentTimeMillis() + addedDate )) } } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiGrades.kt index 01d517ac..6bd7fb57 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiGrades.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiGrades.kt @@ -74,6 +74,10 @@ class MobidziennikApiGrades(val data: DataMobidziennik, rows: List) { subjectId) gradeObject.type = type + if (data.profile?.empty == true) { + addedDate = data.profile.dateSemester1Start.inMillis + } + data.gradeList.add(gradeObject) data.metadataList.add( Metadata(