mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-18 19:20:45 +02:00
Correctly calculates the total of Zaps in a poll
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user