diff --git a/lib/grade/constants.php b/lib/grade/constants.php index 03187ea7d8a..a71a15f74c4 100644 --- a/lib/grade/constants.php +++ b/lib/grade/constants.php @@ -68,7 +68,7 @@ define('GRADE_AGGREGATE_WEIGHTED_MEAN2', 11); define('GRADE_AGGREGATE_EXTRACREDIT_MEAN', 12); /** - * GRADE_AGGREGATE_WEIGHTED_MEAN2 - Use Natural in the category for grade aggregation. + * GRADE_AGGREGATE_SUM - Use Natural in the category for grade aggregation. */ define('GRADE_AGGREGATE_SUM', 13); diff --git a/lib/grade/grade_item.php b/lib/grade/grade_item.php index 71f4003ad70..a36b194caa7 100644 --- a/lib/grade/grade_item.php +++ b/lib/grade/grade_item.php @@ -649,12 +649,16 @@ class grade_item extends grade_object { */ public function set_locked($lockedstate, $cascade=false, $refresh=true) { if ($lockedstate) { - /// setting lock - if ($this->needsupdate) { - return false; // can not lock grade without first having final grade + // Setting lock. + if (empty($this->id)) { + return false; + } else if ($this->needsupdate) { + // Can not lock grade without first having final grade, + // so we schedule it to be locked as soon as regrading is finished. + $this->locktime = time() - 1; + } else { + $this->locked = time(); } - - $this->locked = time(); $this->update(); if ($cascade) { diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 493373c8a05..df9ec8796d6 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -59,7 +59,7 @@ information provided here is intended especially for developers. the page displays a heading for the activity (usually a h2 heading containing the activity name). * New method moodleform::filter_shown_headers() is created to show some expanded headers only and hide the rest. * count_words() and count_letters() have a new optional parameter called $format to format the text before doing the counting. -* New core_renderer::sr_text method to generate screen reader only inline texts without using html_writter. +* New core_renderer::sr_text method to generate screen reader only inline texts without using html_writer. * New events \core\event\qbank_plugin_enabled and \core\event\qbank_plugin_disabled are triggered when a qbank plugin is enabled or disabled respectively, with the plugin's frankenstyle name. Any plugins that need to perform an action in response to a qbank plugin being enabled or disabled should observe these events. @@ -158,6 +158,8 @@ being forced open in all behat tests. but a subset can be specified instead. * core/form-autocomplete now supports disabled options in the source select list. These will be displayed in the autocomplete options with the aria-disabled attribute, and will not be selectable. +* The method grade_item::set_locked() now returns true if the grade item needs to be updated. The method schedules the locking of + the grade item once the recalculations are completed. (This was fixed in 4.3, 4.2.2) === 4.2 ===