Fix ZeroDivisionError (#557)

This commit was merged in pull request #557.
This commit is contained in:
Josh Brown
2024-03-20 17:14:08 +00:00
committed by GitHub
parent 49d1fe0e11
commit c7b336de45

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