From 30e6571b4bc01cf497cf0e425ad30fb803ae909d Mon Sep 17 00:00:00 2001
From: PavelBegunkov <asml.Silence@gmail.com>
Date: Wed, 31 Dec 2014 02:08:22 +0300
Subject: [PATCH] name fixes

---
 db/StoredProcedures.sql | 27 ++++++++++++---------------
 db/fix.sql              |  4 ++--
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql
index 87e2c8bc1..271979392 100644
--- a/db/StoredProcedures.sql
+++ b/db/StoredProcedures.sql
@@ -2850,20 +2850,16 @@ END //
 
 
 
-DROP FUNCTION IF EXISTS OverSession//
-CREATE FUNCTION `OverSession`	(	`TeacherID` 	INT,
-									`DisciplineID` 	INT
-			 					) 	RETURNS int(11)
+DROP FUNCTION IF EXISTS RestrictAfterMilestone//
+CREATE FUNCTION `RestrictAfterMilestone`	(	`TeacherID` 	INT,
+												`DisciplineID` 	INT
+			 								) 	RETURNS int(11)
     NO SQL
 BEGIN 				 
-	IF 	NOT InternalIsTeacherAuthor(TeacherID,DisciplineID)
-	THEN 
-		RETURN -1;
-	END IF;
 
 	UPDATE `disciplines`
-	SET disciplines.OverDate = CURDATE(),
-		disciplines.isOver = 1
+	SET disciplines.MilestoneDate = CURDATE(),
+		disciplines.isMilestone = 1
 	WHERE disciplines.ID = DisciplineID
 	LIMIT 1;
 
@@ -2872,8 +2868,9 @@ END //
 
 
 
-DROP FUNCTION IF EXISTS OverSessionAllCredit//
-CREATE FUNCTION `OverSessionAllCredit`	(	) 	RETURNS int(11)
+DROP FUNCTION IF EXISTS SetMilestoneForCredits//
+CREATE FUNCTION `RestrictAfterMilestoneForCredits`	(	`TeacherID` 	INT
+													) 	RETURNS int(11)
     NO SQL
 BEGIN 	
 	DECLARE semID INT;
@@ -2881,8 +2878,8 @@ BEGIN
 	SET semID = GetCurSemesterID();
 	
 	UPDATE `disciplines`
-	SET disciplines.OverDate = CURDATE(),
-		disciplines.isOver = 1
+	SET disciplines.MilestoneDate = CURDATE(),
+		disciplines.isMilestone = 1
 	WHERE 	disciplines.SemesterID = semID AND
 			disciplines.ExamType = 'credit';
 
@@ -3624,7 +3621,7 @@ BEGIN
     SET mtype = -1;
     SELECT 	modules.DisciplineID, 
     		disciplines.isLocked, 
-    		disciplines.isOver, 
+    		disciplines.isMilestone, 
     		rating_table.StudentID, 
     		submodules.isUsed, 
     		submodules.MaxRate,
diff --git a/db/fix.sql b/db/fix.sql
index d1383adc4..af042e239 100644
--- a/db/fix.sql
+++ b/db/fix.sql
@@ -1,4 +1,4 @@
 ALTER TABLE `disciplines`
-ADD `isOver`  tinyint(1) NOT NULL DEFAULT '0',
-ADD `OverDate` DATE NULL DEFAULT NULL;
+ADD `isMilestone`  int(11) NOT NULL DEFAULT '0',
+ADD `MilestoneDate` DATE NULL DEFAULT NULL;
 
-- 
GitLab