diff --git a/db/StoredFunctions.sql b/db/StoredFunctions.sql
index a66e0a0e7f0b5756fb6325461c8c3b25fe09288f..ef998348013b91819a633e0c87696f1c66d0174c 100644
--- a/db/StoredFunctions.sql
+++ b/db/StoredFunctions.sql
@@ -2075,6 +2075,20 @@ BEGIN
     DECLARE vIsOver, vIsLocked, vIsUsed BOOLEAN DEFAULT FALSE;
     DECLARE EXIT HANDLER FOR SQLEXCEPTION RETURN -1;
 
+    IF pRate < 0 THEN
+        INSERT INTO `logs_rating`
+            (StudentID, SubmoduleID, TeacherID, Rate, Action )
+            VALUES  (pStudentID, pSubModuleID, pTeacherID, pRate, 'delete');
+
+        # TODO: extract method log rate
+        DELETE FROM `rating_table`
+            WHERE   rating_table.StudentID = pStudentID AND
+                    rating_table.SubmoduleID = pSubmoduleID
+            LIMIT 1;
+
+        RETURN ROW_COUNT()-1;
+    END IF;
+
     SET vIsOver = TRUE;
     SELECT  disciplines.ID,
             disciplines.SemesterID,
diff --git a/db/fix.sql b/db/fix.sql
deleted file mode 100644
index 64e31b1f7bc0356a45461f2ddf866cddd3e95784..0000000000000000000000000000000000000000
--- a/db/fix.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-# 03.06.15
-
-DROP TABLE `session_options`;
-CREATE TABLE IF NOT EXISTS `exam_period_options` (
-  `ID` int(11) NOT NULL AUTO_INCREMENT,
-  `SubmoduleID` int(11) NOT NULL,
-  `StudentID` int(11) NOT NULL,
-  `Type` enum('absence','pass'),
-  PRIMARY KEY (`ID`),
-  UNIQUE KEY `SubmoduleID` (`SubmoduleID`,`StudentID`),
-  KEY `SubmoduleID_2` (`SubmoduleID`),
-  KEY `StudentID` (`StudentID`),
-  KEY `StudentID_2` (`StudentID`),
-  KEY `StudentID_3` (`StudentID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-
-
-ALTER TABLE `exam_period_options`
-ADD CONSTRAINT `exam_period_options_ibfk_2` FOREIGN KEY (`StudentID`) REFERENCES `students` (`ID`),
-ADD CONSTRAINT `exam_period_options_ibfk_1` FOREIGN KEY (`SubmoduleID`) REFERENCES `submodules` (`ID`);
-
-UPDATE `subjects` SET `Name`= "Научная  исследовательская работа", `Abbr` = "Курсовая" WHERE `ID` = 346;
-
-
-# 13.05.15
-
-DROP TABLE `page_access`;
-DROP TABLE `general_settings`;
diff --git a/deploy/scripts/status b/status
similarity index 100%
rename from deploy/scripts/status
rename to status
diff --git a/~dev_rating/application/classes/Controller/Handler/Rating.php b/~dev_rating/application/classes/Controller/Handler/Rating.php
index bf2ad78bad373f5ca0c3b82b740da3ebe10ce4db..d64696af96b160c502579d9007fac0ef34b2f7ec 100644
--- a/~dev_rating/application/classes/Controller/Handler/Rating.php
+++ b/~dev_rating/application/classes/Controller/Handler/Rating.php
@@ -4,7 +4,7 @@ class Controller_Handler_Rating extends Controller_Handler
 {
     /** @var  Model_Rating */
     protected $model;
-    
+
     public function before() {
         parent::before();
 
@@ -14,19 +14,19 @@ class Controller_Handler_Rating extends Controller_Handler
 
     public function action_SetRate()
     {
-		$data['success'] = false;
+        $data['success'] = false;
         $this->post -> rule('studentID', 'not_empty')
                     -> rule('studentID', 'digit')
                     -> rule('submoduleID', 'not_empty')
                     -> rule('submoduleID', 'digit')
-                    -> rule('rate', 'digit')
-                    -> rule('rate', 'range', array(':value', -1, 100));
+                    -> rule('rate', 'numeric')
+                    -> rule('rate', 'range', array(':value', -2, 100));
         if($this->post->check()) {
             $result = Model_Rating::SetStudentRate( $this->user->TeacherID,
                                                     $this->post['studentID'],
                                                     $this->post['submoduleID'],
                                                     $this->post['rate']);
-			$data['success'] = ($result[0]['Num'] == 0);
+            $data['success'] = ($result->get('Num') == 0);
         }
         $this->response->body(json_encode($data));
     }
@@ -40,10 +40,10 @@ class Controller_Handler_Rating extends Controller_Handler
         if($this->post->check()) {
             //$SGID = Cookie::get('SGID', null);
             $SG_json = json_decode(Cookie::get('SGID', null), true);
-            
+
             $SG_json[$this->post['disciplineID']] = $this->post['groupSelected'];
 
-            Cookie::set('SGID', json_encode($SG_json), '2592000'); 
+            Cookie::set('SGID', json_encode($SG_json), '2592000');
             $data['success'] = true;
         }
         $this->response->body(json_encode($data));
@@ -75,4 +75,4 @@ class Controller_Handler_Rating extends Controller_Handler
         }
         $this->response->body(json_encode($data));
     }
-}
\ No newline at end of file
+}
diff --git a/~dev_rating/application/classes/Model/Rating.php b/~dev_rating/application/classes/Model/Rating.php
index da4438a4cf1dddb30973e52c1e19e14868caeac0..93ad758912649bc57be7299aa0024b87c247c748 100644
--- a/~dev_rating/application/classes/Model/Rating.php
+++ b/~dev_rating/application/classes/Model/Rating.php
@@ -53,8 +53,6 @@ class Model_Rating extends Model
     }
 
     public static function SetStudentRate($teacher, $student, $submodule, $rate) {
-        if ($rate == -1) $rate = null;  # fixme: kind of shit
-
         $sql = "SELECT `SetStudentRate`(:teacher, :student, :submodule, :rate) AS `Num`";
         return DB::query(Database::SELECT, $sql)
             ->parameters([