From 61201b38ea0807da1e0f4a22ca289e479d84dff0 Mon Sep 17 00:00:00 2001 From: PavelBegunkov <asml.Silence@gmail.com> Date: Sat, 21 Feb 2015 21:48:17 +0300 Subject: [PATCH] FIX: session vars --- db/StoredFunctions.sql | 10 +++++----- .../application/classes/Controller/Handler/Rating.php | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/db/StoredFunctions.sql b/db/StoredFunctions.sql index fa40dbb9c..224d42695 100644 --- a/db/StoredFunctions.sql +++ b/db/StoredFunctions.sql @@ -207,7 +207,7 @@ DROP FUNCTION IF EXISTS SetSemesterID// CREATE FUNCTION `SetSemesterID` (`pSemesterID` INT) RETURNS int(11) NO SQL BEGIN - SET @CurrentSemesterID = pSemesterID; + SET @CurrentSemesterID := pSemesterID; RETURN 0; END // @@ -327,7 +327,7 @@ BEGIN accounts.EMail = pEMail, accounts.ActivationCode = NULL WHERE accounts.ActivationCode = pCode AND - (@vAccountID = accounts.ID) > 0 # save accountID + (@vAccountID := accounts.ID) > 0 # save accountID LIMIT 1; IF (ROW_COUNT() = 0) THEN @@ -1887,12 +1887,12 @@ BEGIN END IF; # add rate, or update old - SET @tmp = -1; + SET @tmp = 0; INSERT INTO `rating_table` (StudentID, TeacherID, SubmoduleID, Rate, Date) VALUES ( pStudentID, pTeacherID, pSubmoduleID, pRate, CURDATE()) ON DUPLICATE KEY UPDATE - rating_table.TeacherID = (@tmp = pTeacherID), + rating_table.TeacherID = (@tmp := pTeacherID), rating_table.Rate = pRate, rating_table.Date = CURDATE(); @@ -1900,7 +1900,7 @@ BEGIN INSERT INTO `logs_rating` (StudentID, SubmoduleID, TeacherID, Rate, Action ) VALUES (pStudentID, pSubModuleID, pTeacherID, pRate, - CASE WHEN @tmp >= 0 THEN 'add' ELSE 'change' END); + CASE WHEN @tmp > 0 THEN 'add' ELSE 'change' END); # lock discipline for structure editing IF NOT vIsLocked THEN diff --git a/~dev_rating/application/classes/Controller/Handler/Rating.php b/~dev_rating/application/classes/Controller/Handler/Rating.php index 3c525ae06..e6250adf0 100644 --- a/~dev_rating/application/classes/Controller/Handler/Rating.php +++ b/~dev_rating/application/classes/Controller/Handler/Rating.php @@ -23,7 +23,6 @@ class Controller_Handler_Rating extends Controller_Handler $this->post->offsetGet('student'), $this->post->offsetGet('submodule'), $this->post->offsetGet('rate')); - echo $result[0]['Num']; $data['success'] = ($result[0]['Num'] == 0); } $this->response->body(json_encode($data)); -- GitLab