[Fix] Case where two evaluation showed in the same time in notification

This commit is contained in:
Lucas Silva 2023-04-27 15:00:26 +02:00
parent 0a2f41c8a0
commit 71e8e2baee
3 changed files with 150 additions and 47 deletions

View File

@ -115,7 +115,8 @@
<div <div
class="item-row column{% if displayFontSmall is defined and displayFontSmall == true %} smallfont{% endif %}"> class="item-row column{% if displayFontSmall is defined and displayFontSmall == true %} smallfont{% endif %}">
{% include '@ChillPerson/AccompanyingCourseWork/_objectifs_results_evaluations.html.twig' with { {% include '@ChillPerson/AccompanyingCourseWork/_objectifs_results_evaluations.html.twig' with {
'displayContent': displayContent 'displayContent': displayContent,
'onlyone': false
} %} } %}
</div> </div>
{% endif %} {% endif %}
@ -195,7 +196,8 @@
<div <div
class="item-bloc colored{% if displayContent is defined %} {{ displayContent }}{% endif %}{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}"> class="item-bloc colored{% if displayContent is defined %} {{ displayContent }}{% endif %}{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}">
{% include 'ChillPersonBundle:AccompanyingCourseWork:_objectifs_results_evaluations.html.twig' with { {% include 'ChillPersonBundle:AccompanyingCourseWork:_objectifs_results_evaluations.html.twig' with {
'displayContent': displayContent 'displayContent': displayContent,
'onlyone' : false
} %} } %}
</div> </div>
</div> </div>

View File

@ -3,6 +3,7 @@
# - displayContent: [short|long] default: short # - displayContent: [short|long] default: short
#} #}
{% if w.results|length > 0 %} {% if w.results|length > 0 %}
<table class="obj-res-eval"> <table class="obj-res-eval">
<thead> <thead>
<th class="obj"><h4 class="title_label">{{ 'accompanying_course_work.goal'|trans }}</h4></th> <th class="obj"><h4 class="title_label">{{ 'accompanying_course_work.goal'|trans }}</h4></th>
@ -64,7 +65,9 @@
</th> </th>
</thead> </thead>
<tbody> <tbody>
{% if onlyone %}
{% for e in w.accompanyingPeriodWorkEvaluations %} {% for e in w.accompanyingPeriodWorkEvaluations %}
{% if evalId is defined and evalId == e.id %}
<tr> <tr>
<td class="eval"> <td class="eval">
<ul class="eval_title"> <ul class="eval_title">
@ -78,13 +81,15 @@
{% if e.endDate %} {% if e.endDate %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span>
<b>{{ e.endDate|format_date('short') }}</b> <b>{{ e.endDate|format_date('short') }}</b>
</li> </li>
{% else %} {% else %}
{% if displayContent is defined and displayContent == 'long' %} {% if displayContent is defined and displayContent == 'long' %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span> <span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li> </li>
{% endif %} {% endif %}
@ -92,13 +97,15 @@
{% if e.maxDate %} {% if e.maxDate %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span>
<b>{{ e.maxDate|format_date('short') }}</b> <b>{{ e.maxDate|format_date('short') }}</b>
</li> </li>
{% else %} {% else %}
{% if displayContent is defined and displayContent == 'long' %} {% if displayContent is defined and displayContent == 'long' %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span> <span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li> </li>
{% endif %} {% endif %}
@ -107,13 +114,15 @@
{% if e.warningInterval and e.warningInterval.d > 0 %} {% if e.warningInterval and e.warningInterval.d > 0 %}
<li> <li>
{% set days = (e.warningInterval.d + e.warningInterval.m * 30) %} {% set days = (e.warningInterval.d + e.warningInterval.m * 30) %}
<span class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span>
{{ 'accompanying_course_work.%days% days before max_date'|trans({'%days%': days }) }} {{ 'accompanying_course_work.%days% days before max_date'|trans({'%days%': days }) }}
</li> </li>
{% else %} {% else %}
{% if displayContent is defined and displayContent == 'long' %} {% if displayContent is defined and displayContent == 'long' %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span> <span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li> </li>
{% endif %} {% endif %}
@ -122,11 +131,99 @@
{% if e.timeSpent is not null and e.timeSpent > 0 %} {% if e.timeSpent is not null and e.timeSpent > 0 %}
<li> <li>
{% set minutes = (e.timeSpent / 60) %} {% set minutes = (e.timeSpent / 60) %}
<span class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span> {{ 'duration.minute'|trans({ '{m}' : minutes }) }} <span
class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span> {{ 'duration.minute'|trans({ '{m}' : minutes }) }}
</li> </li>
{% elseif displayContent is defined and displayContent == 'long' %} {% elseif displayContent is defined and displayContent == 'long' %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li>
{% endif %}
</ul>
</li>
</ul>
{% endif %}
{% endfor %}
{% if recordAction is defined %}
{{ recordAction }}
{% endif %}
{% else %}
{% for e in w.accompanyingPeriodWorkEvaluations %}
<tr>
<td class="eval">
<ul class="eval_title">
<li>
{{ e.evaluation.title|localize_translatable_string }}
<ul class="columns">
<li>
<span
class="item-key">{{ 'accompanying_course_work.start_date'|trans ~ ' : ' }}</span>
<b>{{ e.startDate|format_date('short') }}</b>
</li>
{% if e.endDate %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span>
<b>{{ e.endDate|format_date('short') }}</b>
</li>
{% else %}
{% if displayContent is defined and displayContent == 'long' %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li>
{% endif %}
{% endif %}
{% if e.maxDate %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span>
<b>{{ e.maxDate|format_date('short') }}</b>
</li>
{% else %}
{% if displayContent is defined and displayContent == 'long' %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li>
{% endif %}
{% endif %}
{% if e.warningInterval and e.warningInterval.d > 0 %}
<li>
{% set days = (e.warningInterval.d + e.warningInterval.m * 30) %}
<span
class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span>
{{ 'accompanying_course_work.%days% days before max_date'|trans({'%days%': days }) }}
</li>
{% else %}
{% if displayContent is defined and displayContent == 'long' %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li>
{% endif %}
{% endif %}
{% 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 }) }}
</li>
{% elseif displayContent is defined and displayContent == 'long' %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span> <span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li> </li>
{% endif %} {% endif %}
@ -140,7 +237,8 @@
{% if displayContent is defined and displayContent == 'long' %} {% if displayContent is defined and displayContent == 'long' %}
{% if e.comment is not empty %} {% if e.comment is not empty %}
<blockquote class="chill-user-quote">{{ e.comment|chill_entity_render_box }}</blockquote> <blockquote
class="chill-user-quote">{{ e.comment|chill_entity_render_box }}</blockquote>
{% endif %} {% endif %}
{% import "@ChillDocStore/Macro/macro.html.twig" as m %} {% import "@ChillDocStore/Macro/macro.html.twig" as m %}
@ -171,6 +269,7 @@
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endif %}
</tbody> </tbody>
</table> </table>
{% endif %} {% endif %}

View File

@ -23,7 +23,9 @@
'w': document.accompanyingPeriodWorkEvaluation.accompanyingPeriodWork, 'w': document.accompanyingPeriodWorkEvaluation.accompanyingPeriodWork,
'd': document.storedObject, 'd': document.storedObject,
'displayContent': 'short', 'displayContent': 'short',
'recordAction': _self.recordAction(document) 'recordAction': _self.recordAction(document),
'onlyone' : true,
'evalId': document.accompanyingPeriodWorkEvaluation.id
} %} } %}
</div> </div>