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( ...@@ -96,38 +96,40 @@ class CertificatesViewModel @AssistedInject constructor(
} }
} }
private fun Collection<TestCertificateWrapper>.toCertificateItems(): List<CertificatesItem> = map { certificate -> private fun Collection<TestCertificateWrapper>.toCertificateItems(): List<CertificatesItem> = this
val localRegistrationTime = certificate.registeredAt.toUserTimeZone() .map { certificate ->
val localRegistrationTime = certificate.registeredAt.toUserTimeZone()
if (certificate.isCertificateRetrievalPending) { if (certificate.isCertificateRetrievalPending) {
CovidTestCertificateErrorCard.Item( CovidTestCertificateErrorCard.Item(
testDate = localRegistrationTime, testDate = localRegistrationTime,
isUpdatingData = certificate.isUpdatingData, isUpdatingData = certificate.isUpdatingData,
onRetryAction = { onRetryAction = {
refreshTestCertificate(certificate.identifier) refreshTestCertificate(certificate.identifier)
}, },
onDeleteAction = { onDeleteAction = {
events.postValue( events.postValue(
CertificatesFragmentEvents.ShowDeleteErrorCertificateDialog( CertificatesFragmentEvents.ShowDeleteErrorCertificateDialog(
certificate.identifier certificate.identifier
)
) )
) }
} )
) } else {
} else { CovidTestCertificateCard.Item(
CovidTestCertificateCard.Item( testDate = localRegistrationTime,
testDate = localRegistrationTime, testPerson =
testPerson = certificate.testCertificate?.firstName + " " +
certificate.testCertificate?.firstName + " " + certificate.testCertificate?.lastName,
certificate.testCertificate?.lastName, onClickAction = {
onClickAction = { CertificatesFragmentEvents.GoToCovidCertificateDetailScreen(
CertificatesFragmentEvents.GoToCovidCertificateDetailScreen( certificate.identifier
certificate.identifier ).run { events.postValue(this) }
).run { events.postValue(this) } }
} )
) }
} }
} .sortedByDescending { it.testDate }
@AssistedFactory @AssistedFactory
interface Factory : SimpleCWAViewModelFactory<CertificatesViewModel> 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