Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ constructor(
.activeTasks()
.sortedWith(
compareBy<Task>(
{ it.clinicVisitOrder(metaCodingSystemTag) ?: Integer.MAX_VALUE },
{ it.clinicVisitOrder(metaCodingSystemTag) ?: Double.MAX_VALUE },
// tasks with no clinicVisitOrder, would be sorted with Task#description
{ it.description }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.smartregister.fhircore.engine.util.extension

import androidx.core.text.isDigitsOnly
import org.hl7.fhir.r4.model.Coding
import org.hl7.fhir.r4.model.Task
import org.smartregister.fhircore.engine.util.DateUtils
Expand Down Expand Up @@ -44,9 +43,8 @@ fun Task.clinicVisitOrder(systemTag: String) =
.filter { it.system.equals(systemTag, true) }
.filterNot { it.code.isNullOrBlank() }
.map { it.code.replace("_", "-").substringAfterLast("-").trim() }
.filter { it.isDigitsOnly() }
.map { it.toInt() }
.firstOrNull()
.map { it.toDouble() }
.lastOrNull()

fun Task.isGuardianVisit(systemTag: String) =
this.meta.tag.filter { it.system.equals(systemTag, true) }.any {
Expand Down