From 421c1706d1808bf787e023b7af6f2c2fe9c61b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A7=D0=B5=D1=80=D0=B4=D1=8B=D0=BD=D1=86=D0=B5=D0=B2?= =?UTF-8?q?=D0=B0=20=D0=9C=D0=B0=D1=80=D0=B8=D0=BD=D0=B0?= <maric@math.sfedu.ru> Date: Thu, 22 Jan 2015 16:56:50 +0300 Subject: [PATCH] =?UTF-8?q?FIX:=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=BE=D0=B1=D0=BE=D1=80?= =?UTF-8?q?=D0=B0=20=D0=B1=D0=B0=D0=BB=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ~dev_rating/media/js/rating.js | 48 ++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/~dev_rating/media/js/rating.js b/~dev_rating/media/js/rating.js index 50afac526..e1de3678e 100644 --- a/~dev_rating/media/js/rating.js +++ b/~dev_rating/media/js/rating.js @@ -1,6 +1,27 @@ var $ = jQuery; $(function() { + + function controlRowVisualization(jRow) { + var jAutoPassCheckBox = jRow.children(".autoPass").children(".autoPassCheck"); + var semesterRate = parseInt(jRow.children(".semesterRateResultCell").text()); + var absence = jRow.children(".absenceCell").children(".absenceCheck").is(":checked"); + if ((semesterRate < 60) || (absence)) + jAutoPassCheckBox.attr("disabled", true); + else + jAutoPassCheckBox.removeAttr("disabled"); + } + + function controlVisualization() { + $(".autoPassCheck") + .each( function() { + controlRowVisualization($(this).parent().parent()); + }); + } + + // on page loaded + controlVisualization(); + var g_col; var g_row; var g_isFocusCell = false; // Стоит фокус на ячейки или нет @@ -159,10 +180,13 @@ $(function() { { // страница оценивания jThis.siblings(".commonCell").each(function(){ // добавим сумму баллов в соседних ячейках - if ($(this).children("input").val() !== "") - rateResult += parseInt($(this).children("input").val()); + var rate = $(this).children("input").val(); + if (rate) + rateResult += parseInt(rate); }); - rateResult += parseInt(jThis.siblings(".examCell").text()); + var examRateStr = jThis.siblings(".examCell").children("p").text(); + if (examRateStr) + rateResult += parseInt(examRateStr); } if (newRate <= g_submoduleMaxRate) @@ -185,11 +209,7 @@ $(function() { jThis.siblings(".rateResultCell").text(correctRate); EventInspector_ShowMsg("Балл добавлен/изменен", "success"); } - else - { - jThis.children("input").val(oldRate); - EventInspector_ShowMsg("Не удалось добавить/изменить балл", "error"); - } + else EventInspector_ShowMsg("Не удалось добавить/изменить балл", "error"); jThis.children("input").removeAttr("disabled"); } } @@ -200,7 +220,9 @@ $(function() { jThis.children("input").val(oldRate); else jThis.children("input").val("0"); - + if(jThis.children("input").val()=="0") + jThis.children("input").val(""); + EventInspector_ShowMsg("Текущий балл превышает максимальный для данного модуля", "error"); jThis.children("input").removeAttr("disabled"); } @@ -235,6 +257,7 @@ $(function() { Rating($(this), oldRate); TdUnFocus(); UnsetTdInfo($(this)); + controlRowVisualization($(this).parent()); }); $(".commonCell").keyup(function(e){ @@ -287,8 +310,11 @@ $(function() { $(".commonCell").children("input").keydown(function(event) { KeyDownOnlyNumber(event); }); - - + + // Нажатие на чекбокс "Автомат" + $(".absenceCheck").click(function(event) { + controlRowVisualization($(this).parent().parent()); + }); // Фильтр по группе $(".groupSelector").change(function() { -- GitLab