Expand timeSpent choices for evaluation document and translate them to user locale or fallback 'fr'

This commit is contained in:
2025-11-05 09:29:50 +00:00
committed by Julien Fastré
parent 4b9db6ceb6
commit 671ed21d59
4 changed files with 153 additions and 33 deletions

View File

@@ -216,9 +216,29 @@
{% if e.timeSpent is not null and e.timeSpent > 0 %}
<li>
{% set minutes = (e.timeSpent / 60) %}
<span
class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span> {{ 'duration.minute'|trans({ '{m}' : minutes }) }}
{% set totalHours = (e.timeSpent / 3600)|round(0, 'floor') %}
{% set totalMinutes = ((e.timeSpent % 3600) / 60)|round(0, 'floor') %}
<span class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span>
{% if totalHours >= 8 %}
{% set days = (totalHours / 8)|round(0, 'floor') %}
{% set remainingHours = totalHours % 8 %}
{% if days > 0 %}
{{ 'duration.day'|trans({ '{d}' : days }) }}
{% endif %}
{% if remainingHours > 0 %}
{{ 'duration.hour'|trans({ '{h}' : remainingHours }) }}
{% endif %}
{% else %}
{% if totalHours > 0 %}
{{ 'duration.hour'|trans({ '{h}' : totalHours }) }}
{% endif %}
{% if totalMinutes > 0 %}
{{ 'duration.minute'|trans({ '{m}' : totalMinutes }) }}
{% endif %}
{% endif %}
</li>
{% elseif displayContent is defined and displayContent == 'long' %}
<li>