From 04c87eec81885831388f1e2ef896fe57fd8253a6 Mon Sep 17 00:00:00 2001
From: PavelBegunkov <asml.Silence@gmail.com>
Date: Sun, 31 Aug 2014 12:22:29 +0400
Subject: [PATCH] reorder students

---
 db/StoredProcedures.sql | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql
index 7c6fb115e..d0feb3a6e 100644
--- a/db/StoredProcedures.sql
+++ b/db/StoredProcedures.sql
@@ -942,6 +942,8 @@ BEGIN
     LIMIT 1;  						 
 	SET semID = GetCurSemesterID();
 
+
+	-- TODO: проверка на привязку студента
 	SELECT 	modules.ID 				AS 'ModuleID', 
 			modules.Name 			AS 'ModuleName', 
 			submodules.ID 			AS 'SubmoduleID', 
@@ -1247,7 +1249,7 @@ BEGIN
 													students.ID = disciplines_students.StudentID
 		WHERE 		disciplines_groups.StudyGroupID IS NOT NULL OR
 					disciplines_students.StudentID IS NOT NULL
-		ORDER BY 	study_groups.Grade ASC, study_groups.GroupNum;
+		ORDER BY 	study_groups.Grade ASC, study_groups.GroupNum ASC, students.LastName ASC, students.FirstName ASC, students.SecondName ASC;
 
 	ELSE 
 		SELECT 	NULL AS 'StudentID',
@@ -1585,7 +1587,7 @@ BEGIN
 				(	( disciplines_students.Type IS NULL OR disciplines_students.Type != 'detach' ) AND 
 					disciplines_groups.StudyGroupID IS NOT NULL 
 				)
-		ORDER BY study_groups.Grade ASC, study_groups.GroupNum ASC;
+		ORDER BY study_groups.Grade ASC, study_groups.GroupNum ASC, students.LastName ASC, students.FirstName ASC, students.SecondName ASC;
 	ELSE 
 		SELECT 	NULL AS 'StudentID',
 				NULL AS 'LastName',
@@ -1813,6 +1815,7 @@ BEGIN
 			disciplines.SubjectID = SubjectID
 	WHERE disciplines.ID = DisciplineID;
 
+	-- TODO: добавить проверки на изменение
 	IF ExamType = 'exam' THEN
 		SET checker = AddModuleExam(TeacherID, DisciplineID);
 	ELSE
-- 
GitLab