Skip to content

Commit

Permalink
MDL-46824 core_grades: Prevent user from using drop lowest/keep highest
Browse files Browse the repository at this point in the history
Part of: MDL-46576
  • Loading branch information
Frederic Massart authored and abgreeve committed Oct 3, 2014
1 parent 4272386 commit 40544c9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions grade/edit/tree/category_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,18 @@ function definition_after_data() {

}

// Prevent the user from using drop lowest/keep highest when the aggregation method cannot handle it.
if (!$grade_category->can_apply_limit_rules()) {
if ($mform->elementExists('keephigh')) {
$mform->setConstant('keephigh', 0);
$mform->hardFreeze('keephigh');
}
if ($mform->elementExists('droplow')) {
$mform->setConstant('droplow', 0);
$mform->hardFreeze('droplow');
}
}

if ($grade_item->is_calculated()) {
// following elements are ignored when calculation formula used
if ($mform->elementExists('aggregation')) {
Expand Down

0 comments on commit 40544c9

Please sign in to comment.