Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Reset toggle selection once certificates changes (#5590)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwalli authored Sep 26, 2022
1 parent d3bb2cd commit dac8e06
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class PersonOverviewViewModel @AssistedInject constructor(
),
colorShade = color,
badgeCount = person.badgeCount,
certificateSelection = selections[person.personIdentifier.groupingKey] ?: CertificateSelection.FIRST,
certificateSelection = selections[person.selectionKey] ?: CertificateSelection.FIRST,
onClickAction = { _, position ->
person.personIdentifier.let { personIdentifier ->
events.postValue(
Expand All @@ -145,7 +145,7 @@ class PersonOverviewViewModel @AssistedInject constructor(
onCertificateSelected = { selection ->
selectedCertificates.update { prevSelections ->
prevSelections.mutate {
put(person.personIdentifier.groupingKey, selection)
put(person.selectionKey, selection)
}.also {
savedState[SELECTIONS_KEY] = it
}
Expand All @@ -154,6 +154,9 @@ class PersonOverviewViewModel @AssistedInject constructor(
)
}

private val PersonCertificates.selectionKey
get() = verificationCertificates.map { it.cwaCertificate.qrCodeHash }.sorted().joinToString()

private fun MutableList<PersonCertificatesItem>.addPendingCards(tcWrappers: Set<TestCertificateWrapper>) {
tcWrappers.filter {
it.isCertificateRetrievalPending
Expand Down

0 comments on commit dac8e06

Please sign in to comment.