Skip to content

Commit

Permalink
fixed the logic to enable to remove the selection of selected NP
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurKun21 committed Dec 30, 2023
1 parent eab67af commit d2dd5cf
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,23 @@ private fun SelectNps(
modifier = Modifier
.padding(5.dp),
onClick = {
if (canSelect) {
val newNpSequence = when (isSelected) {
true -> npSequence.filter { m -> m.toString() != servantNumber.toString() }
false -> npSequence + servantNumber
val newNpSequence = when {
canSelect -> {
if (isSelected) {
npSequence.filter { m -> m.toString() != servantNumber.toString() }
} else {
npSequence + servantNumber
}
}
isSelected -> {
npSequence.filter { m -> m.toString() != servantNumber.toString() }
}
else -> {
npSequence.dropLast(1) + servantNumber
}
onNpSequenceChange(newNpSequence)
} else {
val newNpSequence = npSequence.dropLast(1) + servantNumber
onNpSequenceChange(newNpSequence)
}
onNpSequenceChange(newNpSequence)


}
) {
Expand Down

0 comments on commit d2dd5cf

Please sign in to comment.