Fix calculation of budget balance

This commit is contained in:
2026-01-12 10:34:30 +01:00
parent 47b285b584
commit 281887355f
2 changed files with 14 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
kind: Fixed
body: Fix the calculation of budget balance to only take into account resources and charges that are still actual
time: 2026-01-12T10:34:11.032115897+01:00
custom:
Issue: ""
SchemaChange: No schema change

View File

@@ -72,14 +72,20 @@
{% macro table_results(actualCharges, actualResources, results) %}
{% set now = date() %}
{% set totalCharges = 0 %}
{% for c in actualCharges %}
{% set totalCharges = totalCharges + c.amount %}
{% if c.startDate <= now and (c.endDate is null or c.endDate >= now) %}
{% set totalCharges = totalCharges + c.amount %}
{% endif %}
{% endfor %}
{% set totalResources = 0 %}
{% for r in actualResources %}
{% set totalResources = totalResources + r.amount %}
{% if r.startDate <= now and (r.endDate is null or r.endDate >= now) %}
{% set totalResources = totalResources + r.amount %}
{% endif %}
{% endfor %}
{% set result = (totalResources - totalCharges) %}