mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-26 00:29:40 +02:00
Fix ZeroDivisionError (#557)
This commit is contained in:
parent
49d1fe0e11
commit
c7b336de45
1 changed files with 2 additions and 1 deletions
|
@ -40,7 +40,8 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
def percent_of_total
|
def percent_of_total
|
||||||
return 100 if parent.nil?
|
return 100 if parent.nil? || parent.sum.zero?
|
||||||
|
|
||||||
((sum / parent.sum) * 100).round(1)
|
((sum / parent.sum) * 100).round(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue