Skip to content
Snippets Groups Projects
Commit 993873b0 authored by Антон Шалимов's avatar Антон Шалимов
Browse files

Merge branch 'develop' of http://itlab.mmcs.sfedu.ru/git/grade-rating into develop

parents 5b297a72 4436e76d
Branches
Tags
No related merge requests found
......@@ -2312,7 +2312,7 @@ CREATE FUNCTION `ChangeDisciplineControl` ( `TeacherID` INT,
) RETURNS int(11)
NO SQL
BEGIN
DECLARE checker, extraMax INT;
DECLARE checker, extraMax, vExtraID INT;
IF InternalIsMapLocked(DisciplineID) OR
NOT InternalIsTeacherAuthor(TeacherID,DisciplineID)
......@@ -2327,9 +2327,25 @@ BEGIN
WHERE disciplines.ID = DisciplineID
LIMIT 1;
-- get Extra module id
SET vExtraID = -1;
SELECT modules.ID
INTO vExtraID
FROM `modules`
WHERE modules.Type = 4 AND
modules.DisciplineID = DisciplineID
LIMIT 1;
IF vExtraID <= 0 THEN
RETURN -1;
END IF;
IF (checker != ExamType)
THEN
IF ExamType = 'exam' THEN
SET extraMax = 6;
SET checker = GetDisciplineMaxRate(DisciplineID);
IF checker >= 61 THEN
RETURN 1;
......@@ -2338,26 +2354,14 @@ BEGIN
-- delete extra module from
DELETE FROM `submodules`
WHERE submodules.ID IN
(
SELECT submodules.ID
FROM `modules`
LEFT JOIN `submodules` ON submodules.ModuleID = modules.ID
WHERE modules.Type = 4 and modules.DisciplineID = DisciplineID and submodules.OrderNum > 1
);
SET extraMax = 6;
WHERE submodules.OrderNum > 1 AND
submodules.ModuleID = vExtraID;
ELSE
SET extraMax = 30;
SET checker = DeleteModuleExam(TeacherID, DisciplineID);
SELECT AddSubmodule(disciplines.AuthorID, modules.ID, extraMax, '', NULL, 'LandmarkControl')
INTO checker
FROM `modules`
INNER JOIN `disciplines` ON disciplines.ID = modules.DisciplineID
WHERE modules.Type = 4 AND
modules.DisciplineID = DisciplineID;
SET checker = AddSubmodule(TeacherID, vExtraID, extraMax, '', NULL, 'LandmarkControl');
END IF;
......@@ -2367,13 +2371,7 @@ BEGIN
UPDATE `submodules`
SET submodules.MaxRate = extraMax
WHERE submodules.ModuleID IN
(
SELECT modules.ID
FROM `modules`
WHERE modules.DisciplineID = DisciplineID AND
modules.Type = 4
);
WHERE submodules.ModuleID = vExtraID;
END IF;
RETURN 0;
END //
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment