Permalink
Browse files

SCORM MDL-21568 fix regression merged from head

  • Loading branch information...
danmarsden committed Jul 17, 2010
1 parent e13b7dc commit c35d76a0669920cecd6dc4362b8c7fee683a2c5a
Showing with 10 additions and 6 deletions.
  1. +10 −6 mod/scorm/db/upgrade.php
View
@@ -302,19 +302,23 @@ function xmldb_scorm_upgrade($oldversion=0) {
$result = $result && add_field($table, $field);
/// fix bad usage of whatgrade/grading method.
$scorms = get_records('scorm');
- foreach ($scorms as $scorm) {
- $scorm->whatgrade = $scorm->grademethod/10;
- update_record('scorm', $scorm);
+ if (!empty($scorm)) {
+ foreach ($scorms as $scorm) {
+ $scorm->whatgrade = $scorm->grademethod/10;
+ update_record('scorm', $scorm);
+ }
}
set_config('whatgradefixed', '1', 'scorm'); //set this so that when upgrade to Moodle 2.0 we don't do this again.
}
}
if ($result && $oldversion < 2007110503) {
/// fix bad usage of whatgrade/grading method
$scorms = get_records('scorm');
- foreach ($scorms as $scorm) {
- $scorm->grademethod = $scorm->grademethod%10;
- update_record('scorm', $scorm);
+ if (!empty($scorm)) {
+ foreach ($scorms as $scorm) {
+ $scorm->grademethod = $scorm->grademethod%10;
+ update_record('scorm', $scorm);
+ }
}
set_config('grademethodfixed', '1', 'scorm'); //set this so that when upgrade to Moodle 2.0 we don't do this again.
}

0 comments on commit c35d76a

Please sign in to comment.