mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-19 18:11:51 +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 {
|
fun totalZapped(): BigDecimal {
|
||||||
return pollNote?.zaps?.values?.sumOf {
|
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)
|
} ?: BigDecimal(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user