diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql index e1315c3b5b252658b855ea11fafcc1771d43385d..c6c3220ba6df9b45aef3531c28b05a45212e767d 100644 --- a/db/StoredProcedures.sql +++ b/db/StoredProcedures.sql @@ -2071,10 +2071,26 @@ BEGIN DisciplineID = modules.DisciplineID LEFT JOIN `rating_table` ON submodules.ID = rating_table.SubmoduleID AND StudentID = rating_table.StudentID - ORDER BY modules.OrderNum ASC, + ORDER BY OrderModuleTypesForSession(modules.Type) ASC, submodules.OrderNum ASC; END // +DROP FUNCTION IF EXISTS OrderModuleTypesForSession// +CREATE FUNCTION `OrderModuleTypesForSession` ( IN `ModuleType` INT + ) RETURNS INT(3) + NO SQL +BEGIN + DECLARE Res INT; + SET Res = 0; + IF ModuleType = 'extra' THEN SET Res = 1; + ELSEIF ModuleType = 'exam' THEN SET Res = 2; + ELSEIF ModuleType = 'bonus' THEN SET Res = 3; + ELSE SET Res = 4; + END IF; + + RETURN Res; +END // + DROP PROCEDURE IF EXISTS GetMapForDiscipline// @@ -2139,7 +2155,7 @@ BEGIN INNER JOIN `subjects` ON disciplines.SubjectID = subjects.ID WHERE modules.DisciplineID = DisciplineID AND (modules.Type = 4 OR modules.Type = 2) - ORDER BY modules.OrderNum ASC, + ORDER BY OrderModuleTypesForSession(modules.Type) ASC, submodules.OrderNum ASC; END IF; END // diff --git a/~dev_rating/application/classes/Controller/Teacher/Rating.php b/~dev_rating/application/classes/Controller/Teacher/Rating.php index 630af019b4f8b6d85ed1bcc7e6d43cb9a4547ad5..3842b528eb7313d8a7ee8dd5efce371154b26189 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Rating.php +++ b/~dev_rating/application/classes/Controller/Teacher/Rating.php @@ -232,7 +232,7 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { $twig = Twig::factory("teacher/".$page_type); //TODO: validate twig $id = $this->request->param('id'); $disciplineInfo = $this->getDisciplineInformation($id); - $structureHandled = $this->getStructure($id, $page_type); + $structureHandled = $this->getStructure($id, $page_type); // Студенты и их баллы $students = $this->model_rating->GetStudentsForRating($this->UserInfo['TeacherID'], $id);