Skip to content
Snippets Groups Projects
Unverified Commit 7eadc890 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Sort test certificates by descending order. (#3470)


Co-authored-by: default avatarBMItter <Berndus@gmx.de>
parent 7b54efe5
No related branches found
No related tags found
No related merge requests found
......@@ -96,38 +96,40 @@ class CertificatesViewModel @AssistedInject constructor(
}
}
private fun Collection<TestCertificateWrapper>.toCertificateItems(): List<CertificatesItem> = map { certificate ->
val localRegistrationTime = certificate.registeredAt.toUserTimeZone()
private fun Collection<TestCertificateWrapper>.toCertificateItems(): List<CertificatesItem> = this
.map { certificate ->
val localRegistrationTime = certificate.registeredAt.toUserTimeZone()
if (certificate.isCertificateRetrievalPending) {
CovidTestCertificateErrorCard.Item(
testDate = localRegistrationTime,
isUpdatingData = certificate.isUpdatingData,
onRetryAction = {
refreshTestCertificate(certificate.identifier)
},
onDeleteAction = {
events.postValue(
CertificatesFragmentEvents.ShowDeleteErrorCertificateDialog(
certificate.identifier
if (certificate.isCertificateRetrievalPending) {
CovidTestCertificateErrorCard.Item(
testDate = localRegistrationTime,
isUpdatingData = certificate.isUpdatingData,
onRetryAction = {
refreshTestCertificate(certificate.identifier)
},
onDeleteAction = {
events.postValue(
CertificatesFragmentEvents.ShowDeleteErrorCertificateDialog(
certificate.identifier
)
)
)
}
)
} else {
CovidTestCertificateCard.Item(
testDate = localRegistrationTime,
testPerson =
certificate.testCertificate?.firstName + " " +
certificate.testCertificate?.lastName,
onClickAction = {
CertificatesFragmentEvents.GoToCovidCertificateDetailScreen(
certificate.identifier
).run { events.postValue(this) }
}
)
}
)
} else {
CovidTestCertificateCard.Item(
testDate = localRegistrationTime,
testPerson =
certificate.testCertificate?.firstName + " " +
certificate.testCertificate?.lastName,
onClickAction = {
CertificatesFragmentEvents.GoToCovidCertificateDetailScreen(
certificate.identifier
).run { events.postValue(this) }
}
)
}
}
}
.sortedByDescending { it.testDate }
@AssistedFactory
interface Factory : SimpleCWAViewModelFactory<CertificatesViewModel>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment