From 29c986407bb6c70c09ed173ad082a92e47972bb2 Mon Sep 17 00:00:00 2001 From: Deep Vora <70479785+deeppp15@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:39:00 -0500 Subject: [PATCH] all: smoother pending survey notifications (fixes #4900) (#4901) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../ole/planet/myplanet/ui/dashboard/DashboardActivity.kt | 5 +++-- .../planet/myplanet/ui/dashboard/DashboardActivity.kt.lite | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c39d0dd8a9..0c897f0607 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2147 - versionName "0.21.47" + versionCode 2148 + versionName "0.21.48" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt index f83aea55b9..e762cdcd60 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt @@ -313,7 +313,7 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N val hasUnfinishedSurvey = mRealm.where(RealmStepExam::class.java) .equalTo("courseId", courseId) - .equalTo("type", "surveys") + .equalTo("type", "survey") .findAll() .any { survey -> !TakeCourseFragment.existsSubmission(mRealm, survey.id, "survey") } @@ -561,8 +561,9 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N private fun getSurveyTitlesFromSubmissions(submissions: List): List { val titles = mutableListOf() submissions.forEach { submission -> + val examId = submission.parentId?.split("@")?.firstOrNull() ?: "" val exam = mRealm.where(RealmStepExam::class.java) - .equalTo("id", submission.parentId) + .equalTo("id", examId) .findFirst() exam?.name?.let { titles.add(it) } } diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite index 7255cdff4a..a24fbb6d61 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite +++ b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite @@ -313,7 +313,7 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N val hasUnfinishedSurvey = mRealm.where(RealmStepExam::class.java) .equalTo("courseId", courseId) - .equalTo("type", "surveys") + .equalTo("type", "survey") .findAll() .any { survey -> !TakeCourseFragment.existsSubmission(mRealm, survey.id, "survey") } @@ -561,8 +561,9 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N private fun getSurveyTitlesFromSubmissions(submissions: List): List { val titles = mutableListOf() submissions.forEach { submission -> + val examId = submission.parentId?.split("@")?.firstOrNull() ?: "" val exam = mRealm.where(RealmStepExam::class.java) - .equalTo("id", submission.parentId) + .equalTo("id", examId) .findFirst() exam?.name?.let { titles.add(it) } }