Skip to content
Snippets Groups Projects
Commit f762476b authored by xamgore's avatar xamgore
Browse files

Removed unwanted behaviour of checking a discipline's existence

parent b575da12
Branches
Tags
No related merge requests found
......@@ -107,13 +107,6 @@ class Controller_Handler_Map extends Controller_Handler {
-> rule('GradeID', 'digit');
if($this->post->check()) {
if (Model_Discipline::exists($this->user['TeacherID'], $this->post['SubjectID'], $this->post['GradeID'])) {
//throw HTTP_Exception::factory(403, "Дисциплина с таким курсом уже существует");
$data = ['success' => false, 'code' => 1];
$this->response->body(json_encode($data));
return;
}
$result = Model_Discipline::changeGrade(
$this->post['DisciplineID'],
$this->user['TeacherID'],
......
......@@ -142,24 +142,6 @@ class Model_Discipline extends Model implements JsonSerializable
return DB::query(Database::SELECT, $sql)->execute();
}
/**
* Check, whether discipline already exists.
*
* @param $teacher int teacher id
* @param $subject int subject id
* @param $grade int grade num (1-7)
* @return true, if exists
*/
public static function exists($teacher, $subject, $grade) {
$disciplines = Model_Disciplines::ofTeacher($teacher);
foreach ($disciplines as $d) {
if ($subject == $d['SubjectID'] && $grade == $d['GradeNum'])
return true;
}
return false;
}
/**
* @param $teacherID int
* @param $disciplineID int
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment