Skip to content

Commit 34799b5

Browse files
[Quest/Malawi Core] Android App : Duplicate Tasks Kotlin Fix (#48)
* [Quest/Malawi Core] Android App : Duplicate Tasks Kotlin Fix * Bug fix * Update build.gradle.kts --------- Co-authored-by: Christopher Seven Phiri <chris7phiri@gmail.com>
1 parent d5b13d8 commit 34799b5

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

android/engine/src/main/java/org/smartregister/fhircore/engine/data/local/register/dao/HivRegisterDao.kt

+12-2
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,18 @@ constructor(
312312
}
313313
}
314314

315-
internal suspend fun Patient.activeCarePlans() =
316-
patientCarePlan(this.logicalId).filter { it.status == CarePlan.CarePlanStatus.ACTIVE }
315+
internal suspend fun Patient.activeCarePlans(): List<CarePlan> {
316+
patientCarePlan(this.logicalId)
317+
.filter { it.status == CarePlan.CarePlanStatus.ACTIVE }
318+
.apply {
319+
val sortByLastUpdated = sortedBy { it.meta.lastUpdated }
320+
return if (size > 1 || size == 1) {
321+
listOf(sortByLastUpdated.first())
322+
} else {
323+
listOf()
324+
}
325+
}
326+
}
317327

318328
internal suspend fun patientCarePlan(patientId: String) =
319329
defaultRepository.searchResourceFor<CarePlan>(

android/quest/build.gradle.kts

+4-4
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ android {
145145
dimension = "apps"
146146
applicationIdSuffix = ".mwcore"
147147
versionNameSuffix = "-mwcore"
148-
versionCode = 35
149-
versionName = "0.1.24"
148+
versionCode = 36
149+
versionName = "0.1.25"
150150
}
151151
create("mwcoreDev") {
152152
dimension = "apps"
@@ -159,8 +159,8 @@ android {
159159
dimension = "apps"
160160
applicationIdSuffix = ".mwcoreProd"
161161
versionNameSuffix = "-mwcoreProd"
162-
versionCode = 12
163-
versionName = "0.1.2"
162+
versionCode = 14
163+
versionName = "0.1.3"
164164
}
165165
create("afyayangu") {
166166
dimension = "apps"

0 commit comments

Comments
 (0)