Merge pull request #8735 from mansuf/develop

Fix `Division error by zero` in budget views
This commit is contained in:
James Cole 2024-03-31 08:37:09 +02:00 committed by GitHub
commit f104b76f73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -324,7 +324,7 @@
{# the amount left is automatically calculated. #}
{{ formatAmountBySymbol(spentInfo.spent + budgetLimit.amount, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }}
{% if spentInfo.spent + budgetLimit.amount > 0 %}
({{ formatAmountBySymbol((spentInfo.spent + budgetLimit.amount) / activeDaysLeft, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }})
({{ formatAmountBySymbol((0 is same as(activeDaysLeft)) ? (spentInfo.spent + budgetLimit.amount) : (spentInfo.spent + budgetLimit.amount) / activeDaysLeft, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }})
{% else %}
({{ formatAmountBySymbol(0, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }})
{% endif %}