From c09e6fa3e3fbffc55d01cb3f79de5af243e8df0e Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Fri, 26 Sep 2014 17:29:33 -0700 Subject: [PATCH] MDL-40697 core_grades: removed existing user_graded event triggers --- grade/edit/tree/grade.php | 8 -------- grade/report/grader/ajax_callbacks.php | 10 ---------- grade/report/grader/lib.php | 11 ----------- 3 files changed, 29 deletions(-) diff --git a/grade/edit/tree/grade.php b/grade/edit/tree/grade.php index 62536f65d98..dd9cce37116 100644 --- a/grade/edit/tree/grade.php +++ b/grade/edit/tree/grade.php @@ -265,14 +265,6 @@ if ($mform->is_cancelled()) { $grade_item->force_regrading(); } - $grade_grade = new grade_grade(array('userid'=>$data->userid, 'itemid'=>$grade_item->id), true); - if ($old_grade_grade->finalgrade != $grade_grade->finalgrade - or empty($old_grade_grade->overridden) != empty($grade_grade->overridden) - ) { - $grade_grade->grade_item = $grade_item; - \core\event\user_graded::create_from_grade($grade_grade)->trigger(); - } - redirect($returnurl); } diff --git a/grade/report/grader/ajax_callbacks.php b/grade/report/grader/ajax_callbacks.php index d49e26581f2..f0c7188ffff 100644 --- a/grade/report/grader/ajax_callbacks.php +++ b/grade/report/grader/ajax_callbacks.php @@ -120,8 +120,6 @@ switch ($action) { } else { $json_object->gradevalue = $finalvalue; - $old_grade_grade = new grade_grade(array('userid' => $userid, 'itemid' => $grade_item->id), true); - if ($grade_item->update_final_grade($userid, $finalgrade, 'gradebook', $feedback, FORMAT_MOODLE)) { $json_object->result = 'success'; $json_object->message = false; @@ -132,14 +130,6 @@ switch ($action) { die(); } - $grade_grade = new grade_grade(array('userid' => $userid, 'itemid' => $grade_item->id), true); - if ($old_grade_grade->finalgrade != $grade_grade->finalgrade - or empty($old_grade_grade->overridden) != empty($grade_grade->overridden) - ) { - $grade_grade->load_grade_item(); - \core\event\user_graded::create_from_grade($grade_grade)->trigger(); - } - // Get row data $sql = "SELECT gg.id, gi.id AS itemid, gi.scaleid AS scale, gg.userid AS userid, finalgrade, gg.overridden AS overridden " . "FROM {grade_grades} gg, {grade_items} gi WHERE " diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 6aabf4c1a71..586650b89aa 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -305,19 +305,8 @@ class grade_report_grader extends grade_report { } } - $oldgradegrade = new grade_grade(array('userid' => $userid, 'itemid' => $gradeitem->id), true); - $gradeitem->update_final_grade($userid, $finalgrade, 'gradebook', $feedback, FORMAT_MOODLE); - $gradegrade = new grade_grade(array('userid' => $userid, 'itemid' => $gradeitem->id), true); - - if ($oldgradegrade->finalgrade != $gradegrade->finalgrade - or empty($oldgradegrade->overridden) != empty($gradegrade->overridden) - ) { - $gradegrade->grade_item = $gradeitem; - \core\event\user_graded::create_from_grade($gradegrade)->trigger(); - } - // We can update feedback without reloading the grade item as it doesn't affect grade calculations if ($datatype === 'feedback') { $this->grades[$userid][$itemid]->feedback = $feedback;