MDL-52578 core_course: Activity weight set to 0 on creation

This commit is contained in:
Steve Bader
2020-05-20 10:31:31 +08:00
committed by Jun Pataleta
parent e6d212fc07
commit e8e5f49883
+12
View File
@@ -277,6 +277,12 @@ function edit_module_post_actions($moduleinfo, $course) {
if ($update) {
$item->update();
}
$gradecategory = $grade_item->get_parent_category();
if (!empty($moduleinfo->add)) {
if ($grade_item->set_aggregation_fields_for_aggregation(0, $gradecategory->aggregation)) {
$grade_item->update();
}
}
}
}
@@ -333,6 +339,12 @@ function edit_module_post_actions($moduleinfo, $course) {
} else if (isset($moduleinfo->gradecat)) {
$outcomeitem->set_parent($moduleinfo->gradecat);
}
$gradecategory = $outcome_item->get_parent_category();
if ($outcomeexists == false) {
if ($outcome_item->set_aggregation_fields_for_aggregation(0, $gradecategory->aggregation)) {
$outcome_item->update();
}
}
}
}
}