1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Fix ZeroDivisionError (#557)

This commit is contained in:
Josh Brown 2024-03-20 17:14:08 +00:00 committed by GitHub
parent 49d1fe0e11
commit c7b336de45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,7 +40,8 @@
end
def percent_of_total
return 100 if parent.nil?
return 100 if parent.nil? || parent.sum.zero?
((sum / parent.sum) * 100).round(1)
end