MDL-49257 grades: fix bugs with extra credit weights
When we adjust the weights in natural grading (setup screen), the extra credit items should not depend on other overrides. If extra credit item's weight was overriden, it stays as it is. Otherwise it is calculated as itemgrademax / totalgrademax (total excludes extra credit items)
This commit is contained in:
@@ -4399,5 +4399,25 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2015060400.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015061900.00) {
|
||||
// MDL-49257. Changed the algorithm of calculating automatic weights of extra credit items.
|
||||
|
||||
// Before the change, in case when grade category (in "Natural" agg. method) had items with
|
||||
// overridden weights, the automatic weight of extra credit items was illogical.
|
||||
// In order to prevent grades changes after the upgrade we need to freeze gradebook calculation
|
||||
// for the affected courses.
|
||||
|
||||
// This script in included in each major version upgrade process so make sure we don't run it twice.
|
||||
if (empty($CFG->upgrade_extracreditweightsstepignored)) {
|
||||
upgrade_extra_credit_weightoverride();
|
||||
|
||||
// To skip running the same script on the upgrade to the next major release.
|
||||
set_config('upgrade_extracreditweightsstepignored', 1);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015061900.00);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user