Index: mod/scorm/mod_form.php =================================================================== --- mod/scorm/mod_form.php (revision 10) +++ mod/scorm/mod_form.php (working copy) @@ -68,7 +68,7 @@ $mform->addElement('select', 'whatgrade', get_string('whatgrade', 'scorm'), scorm_get_what_grade_array()); $mform->disabledIf('whatgrade', 'maxattempt','eq',1); $mform->setHelpButton('whatgrade', array('whatgrade',get_string('whatgrade', 'scorm'), 'scorm')); - $mform->setDefault('whatgrade', $CFG->scorm_whatgrade); + $mform->setDefault('whatgrade', $CFG->scorm_whatgrade); $mform->setAdvanced('whatgrade'); // Activation period @@ -185,10 +185,10 @@ $default_values[$element] = trim($value); } } - } + + } if (isset($default_values['grademethod'])) { - $default_values['whatgrade'] = intval($default_values['grademethod'] / 10); - $default_values['grademethod'] = $default_values['grademethod'] % 10; + $default_values['grademethod'] = intval($default_values['grademethod']); } if (isset($default_value['width']) && (strpos($default_value['width'],'%') === false) && ($default_value['width'] <= 100)) { $default_value['width'] .= '%'; @@ -242,4 +242,4 @@ parent::set_data($default_values); //never slashed for moodleform_mod } } -?> \ No newline at end of file +?> Index: mod/scorm/lib.php =================================================================== --- mod/scorm/lib.php (revision 10) +++ mod/scorm/lib.php (working copy) @@ -40,7 +40,6 @@ if (!isset($scorm->whatgrade)) { $scorm->whatgrade = 0; } - $scorm->grademethod = ($scorm->whatgrade * 10) + $scorm->grademethod; $id = insert_record('scorm', $scorm); @@ -108,7 +107,6 @@ if (!isset($scorm->whatgrade)) { $scorm->whatgrade = 0; } - $scorm->grademethod = ($scorm->whatgrade * 10) + $scorm->grademethod; // Check if scorm manifest needs to be reparsed if ($scorm->parse == 1) { Index: mod/scorm/restorelib.php =================================================================== --- mod/scorm/restorelib.php (revision 10) +++ mod/scorm/restorelib.php (working copy) @@ -61,6 +61,11 @@ if (!is_int($scorm->maxattempt)) { $scorm->maxattempt = 0; } + $scorm->whatgrade = backup_todb($info['MOD']['#']['WHATGRADE']['0']['#']); + if (!is_int($scorm->whatgrade)) { + $scorm->whatgrade = 0; + } + $scorm->grademethod = backup_todb($info['MOD']['#']['GRADEMETHOD']['0']['#']); if (!is_int($scorm->grademethod)) { $scorm->grademethod = 0; Index: mod/scorm/locallib.php =================================================================== --- mod/scorm/locallib.php (revision 10) +++ mod/scorm/locallib.php (working copy) @@ -316,7 +316,6 @@ if (strstr($element, '.score.raw') || (($element == 'cmi.core.lesson_status' || $element == 'cmi.completion_status') && ($track->value == 'completed' || $track->value == 'passed'))) { $scorm = get_record('scorm', 'id', $scormid); - $grademethod = $scorm->grademethod % 10; include_once('lib.php'); scorm_update_grades($scorm, $userid); } @@ -362,7 +361,7 @@ break; case 'cmi.core.score.raw': case 'cmi.score.raw': - $usertrack->score_raw = sprintf('%0d', $track->value); + $usertrack->score_raw = sprintf('%0.1f', $track->value); break; case 'cmi.core.session_time': case 'cmi.session_time': @@ -447,7 +446,6 @@ // this treatment is necessary as the whatgrade field was not in the DB // and so whatgrade and grademethod are combined in grademethod 10s are whatgrade // and 1s are grademethod - $grademethod = $scorm->grademethod % 10; foreach ($scoes as $sco) { if ($userdata = scorm_get_tracks($sco->id, $userid, $attempt)) { @@ -502,7 +500,6 @@ // this treatment is necessary as the whatgrade field was not in the DB // and so whatgrade and grademethod are combined in grademethod 10s are whatgrade // and 1s are grademethod - $whatgrade = intval($scorm->grademethod / 10); // insure we dont grade user beyond $scorm->maxattempt settings $lastattempt = scorm_get_last_attempt($scorm->id, $userid); @@ -510,7 +507,7 @@ $lastattempt = $scorm->maxattempt; } - switch ($whatgrade) { + switch ($scorm->whatgrade) { case FIRSTATTEMPT: return scorm_grade_user_attempt($scorm, $userid, 1, $time); break; @@ -1324,4 +1321,4 @@ delete_records('scorm_scoes_track', 'userid', $userid, 'scormid', $scormid, 'attempt', $attemptid); return true; } -?>