From 216da19cc9d849ad1f4d668b063a982e8ca8d460 Mon Sep 17 00:00:00 2001 From: Yannik Beaulieu Date: Wed, 27 Mar 2024 18:57:52 -0400 Subject: [PATCH] Add support for negative durations in All Users reports (#4717) --- .../reporting/user_list_period_data.html.twig | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/templates/reporting/user_list_period_data.html.twig b/templates/reporting/user_list_period_data.html.twig index 15f6b82b..5cb98a5e 100644 --- a/templates/reporting/user_list_period_data.html.twig +++ b/templates/reporting/user_list_period_data.html.twig @@ -39,24 +39,18 @@ {% set usersTotalInternalRate = 0 %} {% set usersTotalRate = 0 %} {% for period in attribute(userPeriod, period_attribute) %} - {% if period.totalDuration > 0 %} - {% set usersTotalDuration = usersTotalDuration + period.totalDuration %} - {% set absoluteDuration = absoluteDuration + period.totalDuration %} - {% endif %} - {% if period.totalInternalRate > 0 %} - {% set usersTotalInternalRate = usersTotalInternalRate + period.totalInternalRate %} - {% set absoluteInternalRate = absoluteInternalRate + period.totalInternalRate %} - {% endif %} - {% if period.totalRate > 0 %} - {% set usersTotalRate = usersTotalRate + period.totalRate %} - {% set absoluteRate = absoluteRate + period.totalRate %} - {% endif %} + {% set usersTotalDuration = usersTotalDuration + period.totalDuration %} + {% set absoluteDuration = absoluteDuration + period.totalDuration %} + {% set usersTotalInternalRate = usersTotalInternalRate + period.totalInternalRate %} + {% set absoluteInternalRate = absoluteInternalRate + period.totalInternalRate %} + {% set usersTotalRate = usersTotalRate + period.totalRate %} + {% set absoluteRate = absoluteRate + period.totalRate %} {% set reportDateKey = period.date|report_date %} {% set totalsDuration = totalsDuration|merge({(reportDateKey): (totalsDuration[reportDateKey] + period.totalDuration)}) %} {% set totalsInternalRate = totalsInternalRate|merge({(reportDateKey): (totalsInternalRate[reportDateKey] + period.totalInternalRate)}) %} {% set totalsRate = totalsRate|merge({(reportDateKey): (totalsRate[reportDateKey] + period.totalRate)}) %} {% endfor %} - {% if userPeriod.user.enabled or usersTotalDuration > 0 %} + {% if userPeriod.user.enabled or usersTotalDuration != 0 %} {% if with_avatar %} @@ -81,7 +75,7 @@ {% for period in attribute(userPeriod, period_attribute) %} - {% if period.totalDuration > 0 or period.totalRate > 0 or period.totalInternalRate > 0 %} + {% if period.totalDuration != 0 or period.totalRate != 0 or period.totalInternalRate != 0 %} {% if dataType == 'rate' %} {% block rate %}{% endblock %} {% elseif dataType == 'internalRate' %}