Correctly calculates the total of Zaps in a poll

This commit is contained in:
Vitor Pamplona
2023-04-21 18:20:26 -04:00
parent 9aa5993748
commit ed07248f7d

View File

@@ -110,7 +110,13 @@ class PollNoteViewModel {
fun totalZapped(): BigDecimal {
return pollNote?.zaps?.values?.sumOf {
(it?.event as? LnZapEvent)?.amount ?: BigDecimal(0)
val zapEvent = (it?.event as? LnZapEvent)
if (zapEvent?.zappedPollOption() != null) {
zapEvent.amount ?: BigDecimal(0)
} else {
BigDecimal(0)
}
} ?: BigDecimal(0)
}
}