mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-45029 core_course: set aggregationcoef while creating a new course module
This commit is contained in:
parent
e1eb180806
commit
78618bc677
@ -209,12 +209,23 @@ function edit_module_post_actions($moduleinfo, $course) {
|
||||
}
|
||||
$moduleinfo->gradecat = $grade_category->id;
|
||||
}
|
||||
$gradecategory = $grade_item->get_parent_category();
|
||||
foreach ($items as $itemid=>$unused) {
|
||||
$items[$itemid]->set_parent($moduleinfo->gradecat);
|
||||
if ($itemid == $grade_item->id) {
|
||||
// Use updated grade_item.
|
||||
$grade_item = $items[$itemid];
|
||||
}
|
||||
if (!empty($moduleinfo->add)) {
|
||||
if (grade_category::aggregation_uses_aggregationcoef($gradecategory->aggregation)) {
|
||||
if ($gradecategory->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN) {
|
||||
$grade_item->aggregationcoef = 1;
|
||||
} else {
|
||||
$grade_item->aggregationcoef = 0;
|
||||
}
|
||||
$grade_item->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,6 +284,17 @@ function edit_module_post_actions($moduleinfo, $course) {
|
||||
} else if (isset($moduleinfo->gradecat)) {
|
||||
$outcome_item->set_parent($moduleinfo->gradecat);
|
||||
}
|
||||
$gradecategory = $outcome_item->get_parent_category();
|
||||
if ($outcomeexists == false) {
|
||||
if (grade_category::aggregation_uses_aggregationcoef($gradecategory->aggregation)) {
|
||||
if ($gradecategory->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN) {
|
||||
$outcome_item->aggregationcoef = 1;
|
||||
} else {
|
||||
$outcome_item->aggregationcoef = 0;
|
||||
}
|
||||
$outcome_item->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1141,6 +1141,17 @@ function workshop_grade_item_category_update($workshop) {
|
||||
$gradeitem->set_parent($workshop->gradinggradecategory);
|
||||
}
|
||||
}
|
||||
if (!empty($workshop->add)) {
|
||||
$gradecategory = $gradeitem->get_parent_category();
|
||||
if (grade_category::aggregation_uses_aggregationcoef($gradecategory->aggregation)) {
|
||||
if ($gradecategory->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN) {
|
||||
$gradeitem->aggregationcoef = 1;
|
||||
} else {
|
||||
$gradeitem->aggregationcoef = 0;
|
||||
}
|
||||
$gradeitem->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user