From cb701d8506ed295eddc9ce3ebed352099ae54c6e Mon Sep 17 00:00:00 2001 From: Rahman Yusuf Date: Sun, 31 Mar 2024 12:03:54 +0700 Subject: [PATCH] Fix Division error by zero in budget views --- resources/views/budgets/index.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/budgets/index.twig b/resources/views/budgets/index.twig index 7fa49ed8c3..2f6c27a756 100644 --- a/resources/views/budgets/index.twig +++ b/resources/views/budgets/index.twig @@ -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 %}