diff --git a/db/StoredFunctions.sql b/db/StoredFunctions.sql
index 96bb9126048ae9b96c6436e238809a6630d57a1d..079107647fb210a16c11699173c6e176f5a30ec5 100644
--- a/db/StoredFunctions.sql
+++ b/db/StoredFunctions.sql
@@ -2007,24 +2007,33 @@ CREATE FUNCTION `CalculateMaxRateForExtra`
 ( `pSubmoduleID` INT, `pStudentID` INT) RETURNS int(11)
     NO SQL
 BEGIN
-    DECLARE vExamType INT; # enum('exam', 'credit');# utf8;
+    DECLARE vExamType INT DEFAULT -1; # enum('exam', 'credit');# utf8;
     DECLARE vLim INT;
-    DECLARE vResult INT DEFAULT -1;
+    DECLARE vResult INT DEFAULT 0;
 
-    IF vExamType = 'exam' THEN
+    SELECT  disciplines.ExamType INTO vExamType
+        FROM `submodules`
+        INNER JOIN `modules` ON modules.ID = submodules.ModuleID
+        INNER JOIN `disciplines` ON disciplines.ID = modules.DisciplineID
+        WHERE submodules.ID = pSubmoduleID
+        LIMIT 1;
+
+    IF vExamType = -1 THEN
+        RETURN -1;
+    ELSEIF vExamType = 1 THEN # exam
         SET vLim = 38;
-    ELSE
+    ELSE # credit or grading_credit
         SET vLim = 60;
     END IF;
 
-    SELECT vLim - view_rating_result.RateRegular INTO vResult
+    SELECT  view_rating_result.RateRegular INTO vResult
         FROM `submodules`
         INNER JOIN `modules` ON modules.ID = submodules.ModuleID
         INNER JOIN view_rating_result ON view_rating_result.DisciplineID = modules.DisciplineID AND
                                          view_rating_result.StudentID = pStudentID
         WHERE submodules.ID = pSubmoduleID
         LIMIT 1;
-    RETURN vResult;
+    RETURN vLim - vResult;
 END //
 
 
@@ -2062,6 +2071,7 @@ BEGIN
 
     # 1) check rights
     # 2) check, you can't rate regular and bonus after milestone
+    # 3) check, max rate exceeding
     IF  NOT InternalIsStudentAttached(pStudentID, vDisciplineID) OR
         NOT InternalIsTeacherBounded(pTeacherID, vDisciplineID) OR
         pRate > vMaxRate OR
diff --git a/~dev_rating/application/classes/Controller/Handler/FileCreator.php b/~dev_rating/application/classes/Controller/Handler/FileCreator.php
index 4a7067615d85617a21ea3e6f69e3228e3bbb29ea..6c1127f42a6a36b7b30800379a7f5faa8b79d143 100644
--- a/~dev_rating/application/classes/Controller/Handler/FileCreator.php
+++ b/~dev_rating/application/classes/Controller/Handler/FileCreator.php
@@ -227,7 +227,7 @@ class Controller_Handler_FileCreator extends Controller_Handler
         $controlDate = "";
         $range = $objPHPExcel->getNamedRange("Date")->getRange();
         if ($disciplineType == 'credit') {
-            $controlDate = "Дата зачета\n".$this->figureOutCreditDate($data['SemesterNum'], $data['Year']);
+            $controlDate = "Дата зачета\n".$this->figureOutCreditDate($data['SemesterNum'], $startYear);
         } elseif ($disciplineType == 'exam') {
             $controlDate = "Дата экзамена\n__________";
         }
diff --git a/~dev_rating/application/classes/Controller/Teacher/Rating.php b/~dev_rating/application/classes/Controller/Teacher/Rating.php
index 0707db72bbaba89c719f7e77f9da79676c582c2d..e4986399094c8a1c91d403904059e2b687050e52 100644
--- a/~dev_rating/application/classes/Controller/Teacher/Rating.php
+++ b/~dev_rating/application/classes/Controller/Teacher/Rating.php
@@ -29,8 +29,8 @@ class Controller_Teacher_Rating extends Controller_UserEnvironment {
     private function getDisciplineInformation($id) {
         
         $temp = Model_Discipline::getInfo($id);
-        $disciplineInfo = $temp[0];
-        $disciplineInfo['ID'] = $id;
+        $disciplineInfo = $temp;
+//        $disciplineInfo['ID'] = $id;
         $disciplineInfo['GroupID_Filter'] = $this->getGroupID_ForFilter($id);
 
         return $disciplineInfo;
diff --git a/~dev_rating/application/views/teacher/exam.twig b/~dev_rating/application/views/teacher/exam.twig
index a376a8c92a2aa13e27281f0b25db2cfe230c9ad7..6bdbf70441857651de639e2512a5aadf98001284 100644
--- a/~dev_rating/application/views/teacher/exam.twig
+++ b/~dev_rating/application/views/teacher/exam.twig
@@ -19,7 +19,7 @@
 	{% endif %}
 	</h2>
 
-    {{ HTML.anchor('rate/'~disciplineInfo.ID, 
+    {{ HTML.anchor('rate/'~disciplineInfo.DisciplineID,
             "← Перейти к оцениванию", 
             {'title': 'Оценивание', 'class': 'rate_a'})|raw }}