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, ...@@ -2312,7 +2312,7 @@ CREATE FUNCTION `ChangeDisciplineControl` ( `TeacherID` INT,
) RETURNS int(11) ) RETURNS int(11)
NO SQL NO SQL
BEGIN BEGIN
DECLARE checker, extraMax INT; DECLARE checker, extraMax, vExtraID INT;
IF InternalIsMapLocked(DisciplineID) OR IF InternalIsMapLocked(DisciplineID) OR
NOT InternalIsTeacherAuthor(TeacherID,DisciplineID) NOT InternalIsTeacherAuthor(TeacherID,DisciplineID)
...@@ -2327,9 +2327,25 @@ BEGIN ...@@ -2327,9 +2327,25 @@ BEGIN
WHERE disciplines.ID = DisciplineID WHERE disciplines.ID = DisciplineID
LIMIT 1; 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) IF (checker != ExamType)
THEN THEN
IF ExamType = 'exam' THEN IF ExamType = 'exam' THEN
SET extraMax = 6;
SET checker = GetDisciplineMaxRate(DisciplineID); SET checker = GetDisciplineMaxRate(DisciplineID);
IF checker >= 61 THEN IF checker >= 61 THEN
RETURN 1; RETURN 1;
...@@ -2338,26 +2354,14 @@ BEGIN ...@@ -2338,26 +2354,14 @@ BEGIN
-- delete extra module from -- delete extra module from
DELETE FROM `submodules` DELETE FROM `submodules`
WHERE submodules.ID IN WHERE submodules.OrderNum > 1 AND
( submodules.ModuleID = vExtraID;
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;
ELSE ELSE
SET extraMax = 30; SET extraMax = 30;
SET checker = DeleteModuleExam(TeacherID, DisciplineID); SET checker = DeleteModuleExam(TeacherID, DisciplineID);
SET checker = AddSubmodule(TeacherID, vExtraID, extraMax, '', NULL, 'LandmarkControl');
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;
END IF; END IF;
...@@ -2367,13 +2371,7 @@ BEGIN ...@@ -2367,13 +2371,7 @@ BEGIN
UPDATE `submodules` UPDATE `submodules`
SET submodules.MaxRate = extraMax SET submodules.MaxRate = extraMax
WHERE submodules.ModuleID IN WHERE submodules.ModuleID = vExtraID;
(
SELECT modules.ID
FROM `modules`
WHERE modules.DisciplineID = DisciplineID AND
modules.Type = 4
);
END IF; END IF;
RETURN 0; RETURN 0;
END // 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