Permalink
Browse files

Fixing a bug, default value must be taken from the global $GRADEPREFS…

…DEFAULTS.
  • Loading branch information...
defacer
defacer committed May 4, 2005
1 parent 0549198 commit 914493e96176d0eb46855275017549a34603a0c4
Showing with 5 additions and 5 deletions.
  1. +5 −5 grade/lib.php
View
@@ -873,17 +873,17 @@ function grade_set_preference($courseid, $name, $value) {
}
function grade_get_preference($courseid, $name) {
- global $GRADEPREFS;
+ global $GRADEPREFS, $GRADEPREFSDEFAULTS;
if (false !== ($key = array_search($name, $GRADEPREFS))) {
- if ($record = get_record('grade_preferences', 'courseid', $courseid, 'preference', $key)) {
- return $record->value;
- } else { // Make a new one
+ if (!($record = get_record('grade_preferences', 'courseid', $courseid, 'preference', $key))) {
+ // Make a new one
$record->preference = $key;
$record->courseid = $courseid;
- $record->value = $value;
+ $record->value = $GRADEPREFSDEFAULTS[$name];
insert_record('grade_preferences', $record);
}
+ return $record->value;
}
return NULL;
}

0 comments on commit 914493e

Please sign in to comment.