From 13a1693452d2d48931b662abe8e8346cca01ac78 Mon Sep 17 00:00:00 2001 From: RomanSteinberg <romanofficial@yandex.com> Date: Thu, 3 Sep 2015 13:38:03 +0300 Subject: [PATCH] FIX: rate page summarizing --- media/js/discipline/rating/rate.js | 6 ++++- .../views/teacher/discipline/rating/rate.twig | 26 +++++++++++++------ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/media/js/discipline/rating/rate.js b/media/js/discipline/rating/rate.js index 94eccd098..1c7596f5a 100644 --- a/media/js/discipline/rating/rate.js +++ b/media/js/discipline/rating/rate.js @@ -263,7 +263,11 @@ $(function () { rateResult += parseInt(rate); }); - var additionalRateStr = jThis.siblings(".staticCell").children("p").text(); + var additionalRateStr = jThis.siblings(".extraCell").text(); + if (additionalRateStr) + rateResult += parseInt(additionalRateStr); + + additionalRateStr = jThis.siblings(".examCell").text(); if (additionalRateStr) rateResult += parseInt(additionalRateStr); diff --git a/~dev_rating/application/views/teacher/discipline/rating/rate.twig b/~dev_rating/application/views/teacher/discipline/rating/rate.twig index 2353f8f9e..6a2e26683 100644 --- a/~dev_rating/application/views/teacher/discipline/rating/rate.twig +++ b/~dev_rating/application/views/teacher/discipline/rating/rate.twig @@ -141,6 +141,7 @@ {% for student in StudentsList %} {% set extraRate = 0 %} + {% set examRate = 0 %} {% set sumRate = 0 %} {% set j = 0 %} {% set row = row + 1 %} @@ -157,27 +158,36 @@ {% set j = j + 1 %} - {% if Discipline.Milestone == 0 and Module.Type != 'extra' %} - <td id="col_{{ j }}" class="commonCell"> + {% if Module.Type == 'regular' %} + <td id="col_{{ j }}" class="commonCell {{ Discipline.Milestone ? staticCell }}"> <input type="text" value="{{ rate }}"> </td> {% else %} {% set j = j - 1 %} {% if Module.Type == 'extra' %} {% set extraRate = extraRate + rate %} + {% elseif Module.Type == 'exam' %} + {% set examRate = rate %} {% else %} - <td class="staticCell {{ Module.Type == 'exam' ? 'examCell' }}"> - <p>{{ rate }}</p> - </td> + + {#<td class="staticCell {{ Module.Type == 'exam' ? 'examCell' }}">#} + {#<p>{{ rate }}</p>#} + {#</td>#} {% endif %} {% endif %} {% endfor %} - <td class="staticCell"> - <p>{{ extraRate ? extraRate }}</p> + <td class="staticCell extraCell"> + {#<p>{{ extraRate ? extraRate }}</p>#} + {{ extraRate ? extraRate }} + </td> + + <td class="staticCell examCell"> + {#<p>{{ examRate ? examRate }}</p>#} + {{ examRate ? examRate }} </td> - <td class="rateResultCell staticCell"> + <td class="staticCell rateResultCell"> {{ sumRate > 100 ? '100+' : sumRate }} </td> </tr> -- GitLab