diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql index c09ca7574004d8ec47c251ac91085e34c0d093ac..7e97debe3d38b4b61030ddaa909d8aab1adbf882 100644 --- a/db/StoredProcedures.sql +++ b/db/StoredProcedures.sql @@ -2049,9 +2049,6 @@ BEGIN DisciplineID = modules.DisciplineID LEFT JOIN `rating_table` ON submodules.ID = rating_table.SubmoduleID AND StudentID = rating_table.StudentID - - WHERE modules.Type = 2 OR - modules.Type = 4 ORDER BY modules.OrderNum ASC, submodules.OrderNum ASC; END // diff --git a/~dev_rating/application/classes/Controller/Teacher/Rating.php b/~dev_rating/application/classes/Controller/Teacher/Rating.php index 818c70a0aeabb94c9d690381f0ab4eeede4866e9..479496e24743ec7098395194486e5e6e0f542411 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Rating.php +++ b/~dev_rating/application/classes/Controller/Teacher/Rating.php @@ -205,7 +205,6 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { $structureHandled = array(); $maxRate = 0; $i = 0; $temp_moduleID = 0; $try_1 = 0; // try = 1 - экзамен, = 2, 3 - пересдачи - $examRate = 0; $try = 0; foreach($structure as $row) @@ -240,7 +239,6 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { $structureHandled[$i][$j]['Title'] = 'Основная сдача'; else $structureHandled[$i][$j]['Title'] = 'Пересдача '.$try; - $examRate = $row['MaxRate']; $try++; } //$structureHandled[$i][$j]['Description'] = $row['SubmoduleDescription']; // Описание @@ -294,7 +292,6 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { // Баллы студента $i_r = 0; - $examRate = 0; $extraNum = 0; $rate = $this->model_rating->getMapForStudentExam($row['ID'], $id); @@ -302,48 +299,62 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { $lastExtra = -1; $lastNilExam = -1; $lastNilExtra = -1; + + $curStudent['RateSemesterResult'] = 0; foreach($rate as $r) { - $curRate = array(); - $curRate['SubmoduleID'] = $r['SubmoduleID']; - $curRate['Rate'] = $r['Rate']; - $curRate['ModuleType'] = $r['ModuleType']; - - if (!is_null($r['Rate'])) - { - if ($r['ModuleType'] == 'exam') { - if ($lastExam >= 0) { + if (($r['ModuleType'] == 'exam') or ($r['ModuleType'] == 'extra')) { + $curStudent['Rates'][$i_r] = array(); + $curStudent['Rates'][$i_r]['SubmoduleID'] = $r['SubmoduleID']; + $curStudent['Rates'][$i_r]['Rate'] = $r['Rate']; + $curStudent['Rates'][$i_r]['ModuleType'] = $r['ModuleType']; + } + + switch ($r['ModuleType']) + { + case 'regular': + $curStudent['RateSemesterResult'] += $r['Rate']; + break; + case 'exam': + if (!is_null($r['Rate'])) { + if ($lastExam >= 0) { $curStudent['Rates'][$lastExam]['Block'] = 'True'; } $lastExam = $i_r; - } else if ($r['ModuleType'] == 'extra') { - - if ($lastExtra >= 0) { + } else { + if ($lastNilExam < 0) { + $lastNilExam = $i_r; + } else { + $curStudent['Rates'][$i_r]['Block'] = 'True'; + } + } + break; + case 'bonus': + $curStudent['Bonus'] = $r['Rate']; + break; + case 'extra': + if (!is_null($r['Rate'])) { + if ($lastExtra >= 0) { $curStudent['Rates'][$lastExtra]['Block'] = 'True'; } $lastExtra = $i_r; $curStudent['Rate'] += $r['Rate']; - } - } else { - if ($r['ModuleType'] == 'exam' && $lastNilExam < 0) { - $lastNilExam = $i_r; - } - else if ($r['ModuleType'] == 'extra' && $lastNilExtra < 0) { - $lastNilExtra = $i_r; + } else { + if ($lastNilExtra < 0) { + $lastNilExtra = $i_r; + } else { + $curStudent['Rates'][$i_r]['Block'] = 'True'; + } } - else { - $curRate['Block'] = 'True'; - } - } - - - $curStudent['Rates'][$i_r] = $curRate; + break; + default: + throw HTTP_Exception::factory (500, "Некорректный тип модуля!"); + } + $i_r++; } - - $curStudent['RateResult'] += $examRate; $total = $this->model_rating->GetStudentRate($row['ID'], $id); $total = $total[0]['Num']; if (is_null($total)) $total = 0; @@ -351,23 +362,23 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { if ($lastExam >= 0) { $curStudent['RateResult'] += $curStudent['Rates'][$lastExam]['Rate']; } - $curStudent['RateSemesterResult'] = $total - $curStudent['RateResult']; + $curStudent['RateResult'] = $total; $bottomLimit = 0; $topLimit = ($disciplineInfo['ExamType'] == 'exam') ? 38 : 60; - $extra_rate = 0; + $max_extra_rate = 0; if ($curStudent['RateSemesterResult'] >= $bottomLimit && - $curStudent['RateSemesterResult'] <= $topLimit) + $curStudent['RateSemesterResult'] < $topLimit) // студент задолженик { - $extra_rate = $topLimit - $curStudent['RateSemesterResult']; + $max_extra_rate = $topLimit - $curStudent['RateSemesterResult']; } if ($lastExtra >= 0) { - $curStudent['Rates'][$lastExtra]['MaxRate'] = $extra_rate; + $curStudent['Rates'][$lastExtra]['MaxRate'] = $max_extra_rate; } if ($lastNilExtra >= 0) { - $curStudent['Rates'][$lastNilExtra]['MaxRate'] = $extra_rate; + $curStudent['Rates'][$lastNilExtra]['MaxRate'] = $max_extra_rate; } $rateHandled[$i_g]['Students'][$i_s] = $curStudent; diff --git a/~dev_rating/application/views/teacher/exam.twig b/~dev_rating/application/views/teacher/exam.twig index 9143382306d6a742f0a5ed1c5e2d25ec7421f038..8a7136278a597b6dd746fe67273c68dc968bab0c 100644 --- a/~dev_rating/application/views/teacher/exam.twig +++ b/~dev_rating/application/views/teacher/exam.twig @@ -43,6 +43,7 @@ {{ headerRate[i].ModuleTitle }} </td> {% endfor %} + <td class="subject" rowspan="3">Бонус</td> <td class="subject" rowspan="3">Ртог</td> </tr> <tr class="RatingTableSubmodulesHead"> @@ -100,17 +101,18 @@ {% endif %} {% if r.Block == 'True' %} - <td id="col_{{ col }}" class="staticCell {{ td_class }}"> + <td class="staticCell {{ td_class }}" id="col_{{ col }}"> <input type="text" value="{{ r.Rate }}" disabled="disabled"> </td> {% else %} - <td id="col_{{ col }}" class="commonCell {{ td_class }}"> + <td class="commonCell {{ td_class }}" id="col_{{ col }}"> <input type="text" value="{{ r.Rate }}" {% if r.ModuleType == 'extra' %} placeholder="{% if r.MaxRate > 0 %} макс. {{r.MaxRate}} {% else %} --- {% endif %}"{% endif %}> </td> {% endif %} {% endfor %} + <td class="bonus staticCell">{{ student.Bonus }}</td> <td class="rateResultCell staticCell">{% if student.RateResult > 100 %} 100+ {% else %} {{ student.RateResult }} {% endif %}</td> </tr> {% endfor %} @@ -128,4 +130,5 @@ <div id="hidden_div"> {{ disciplineInfo_JSON|raw }} </div> + <input type="hidden" id="pageType" value="exam"/> {% endblock %} \ No newline at end of file diff --git a/~dev_rating/application/views/teacher/rating.twig b/~dev_rating/application/views/teacher/rating.twig index 97bd2e9c35a36a1fab97b8b4e9db65696430c2ef..c02ec24f12134ea91e5aeb89f4e1b006fc3a360d 100644 --- a/~dev_rating/application/views/teacher/rating.twig +++ b/~dev_rating/application/views/teacher/rating.twig @@ -129,4 +129,5 @@ <div id="hidden_div"> {{ disciplineInfo_JSON|raw }} </div> + <input type="hidden" id="pageType" value="rating"/> {% endblock %} \ No newline at end of file diff --git a/~dev_rating/media/js/rating.js b/~dev_rating/media/js/rating.js index 7bcb5756b3defa3458776a8f83cc36d034724f2c..61ed8277b268bf8877ec21c1701ac5d841e812f0 100644 --- a/~dev_rating/media/js/rating.js +++ b/~dev_rating/media/js/rating.js @@ -1,4 +1,5 @@ var $ = jQuery; + $(function() { var g_col; var g_row; @@ -101,7 +102,7 @@ $(function() { if (jThis.attr("class").indexOf("additionalCell") >= 0) { var t = parseInt(jThis.siblings(".semesterRateResultCell").text()); - if (t > 31 && t < 39) + if (t < 39) g_submoduleMaxRate = 38 - t; else g_submoduleMaxRate = 0; @@ -138,24 +139,23 @@ $(function() { // Здесь jThis - div rateCell, Р° РЅРµ input, который является дочкой jThis.children("input").attr("disabled", true); - var newRate = 0; if (jThis.children("input").val() !== "") newRate = parseInt(jThis.children("input").val()); var rateResult = newRate; // считаем баллы РїРѕ строке - if (jThis.attr("class").indexOf("attemptCell") >= 0) + if ($("#pageType").val() == "exam") //(jThis.attr("class").indexOf("attemptCell") >= 0) { // страница сессии rateResult += parseInt(jThis.siblings(".semesterRateResultCell").text()); - + jThis.siblings(".additionalCell").each(function(){ if ($(this).children("input").val() !== "") rateResult += parseInt($(this).children("input").val()); }); } - else + else if ($("#pageType").val() == "rating") { // страница оценивания jThis.siblings(".commonCell").each(function(){ // добавим СЃСѓРјРјСѓ баллов РІ соседних ячейках @@ -308,8 +308,6 @@ $(function() { } }); - - // Скачать таблицу оценивания РІ формате excel $(".downloadExcel").click(function(){ $.fileDownload(URLdir + 'handler/FileCreator/GenerateExcelRatingTable', {