MDL-80524 rating: preserve activity idnumber when adding rating.
See also e9a5485f for context regarding similar problem with grade
updates.
Co-authored-by: Julian Tovar
This commit is contained in:
co-authored by
Julian Tovar
parent
d33ecac29c
commit
e5ea5e71d5
@@ -52,7 +52,7 @@ final class gradelib_test extends \advanced_testcase {
|
||||
|
||||
// Function grade_update_mod_grades() requires 2 additional properties, cmidnumber and modname.
|
||||
$cm = get_coursemodule_from_instance('assign', $modinstance->id, 0, false, MUST_EXIST);
|
||||
$modinstance->cmidnumber = $cm->id;
|
||||
$modinstance->cmidnumber = $cm->idnumber;
|
||||
$modinstance->modname = 'assign';
|
||||
|
||||
$this->assertTrue(grade_update_mod_grades($modinstance));
|
||||
|
||||
@@ -1133,10 +1133,10 @@ class rating_manager {
|
||||
// Future possible enhancement: add a setting to turn grade updating off for those who don't want them in gradebook.
|
||||
// Note that this would need to be done in both rate.php and rate_ajax.php.
|
||||
if ($context->contextlevel == CONTEXT_MODULE) {
|
||||
// Tell the module that its grades have changed.
|
||||
// Tell the module that its grades have changed (note that 'cmidnumber' is required in order to update grades).
|
||||
$modinstance = $DB->get_record($cm->modname, array('id' => $cm->instance));
|
||||
if ($modinstance) {
|
||||
$modinstance->cmidnumber = $cm->id; // MDL-12961.
|
||||
$modinstance->cmidnumber = $cm->idnumber;
|
||||
$functionname = $cm->modname.'_update_grades';
|
||||
require_once($CFG->dirroot."/mod/{$cm->modname}/lib.php");
|
||||
if (function_exists($functionname)) {
|
||||
|
||||
@@ -99,9 +99,9 @@ if ($userrating != RATING_UNSET_RATING) {
|
||||
}
|
||||
|
||||
if (!empty($cm) && $context->contextlevel == CONTEXT_MODULE) {
|
||||
// Tell the module that its grades have changed.
|
||||
// Tell the module that its grades have changed (note that 'cmidnumber' is required in order to update grades).
|
||||
$modinstance = $DB->get_record($cm->modname, array('id' => $cm->instance), '*', MUST_EXIST);
|
||||
$modinstance->cmidnumber = $cm->id; // MDL-12961.
|
||||
$modinstance->cmidnumber = $cm->idnumber;
|
||||
$functionname = $cm->modname.'_update_grades';
|
||||
require_once($CFG->dirroot."/mod/{$cm->modname}/lib.php");
|
||||
if (function_exists($functionname)) {
|
||||
|
||||
Reference in New Issue
Block a user