Skip to content

Commit

Permalink
MDL-10477 Fixed a small bug in grade/edit/item.php , where I was test…
Browse files Browse the repository at this point in the history
…ing for

if (!empty($data->pref_gradedisplaytype))

which returned false if the value was set to 0. I just changed !empty to isset and it fixed it.
  • Loading branch information
nicolasconnault committed Jul 18, 2007
1 parent e4add64 commit 025bc8d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions grade/edit/item.php
Expand Up @@ -41,8 +41,6 @@
}

if ($data = $mform->get_data()) {
$errors = array();

if (array_key_exists('calculation', $data)) {
$data->calculation = grade_item::normalize_formula($data->calculation, $course->id);
}
Expand All @@ -59,19 +57,19 @@
}

// Handle user preferences
if (!empty($data->pref_gradedisplaytype)) {
if (isset($data->pref_gradedisplaytype)) {
if (!grade_report::set_pref('gradedisplaytype', $data->pref_gradedisplaytype, $grade_item->id)) {
error("Could not set preference gradedisplaytype to $value for this grade item");
}
}

if (!empty($data->pref_decimalpoints)) {
if (isset($data->pref_decimalpoints)) {
if (!grade_report::set_pref('decimalpoints', $data->pref_decimalpoints, $grade_item->id)) {
errors("Could not set preference decimalpoints to $value for this grade item");
error("Could not set preference decimalpoints to $value for this grade item");
}
}

redirect($returnurl, 'temporary debug delay', 10);
redirect($returnurl, 'temporary debug delay', 50);
}

$strgrades = get_string('grades');
Expand Down

0 comments on commit 025bc8d

Please sign in to comment.