SCORM MDL-23776 check for attempts that have passed as well as completed status

This commit is contained in:
Dan Marsden
2010-08-11 23:57:03 +00:00
parent 50412dc1ec
commit ed98c4e98e
+1 -1
View File
@@ -642,7 +642,7 @@ function scorm_get_last_completed_attempt($scormid, $userid) {
global $DB;
/// Find the last attempt number for the given user id and scorm id
if ($lastattempt = $DB->get_record('scorm_scoes_track', array('userid'=>$userid, 'scormid'=>$scormid, 'value'=> 'completed'), 'max(attempt) as a')) {
if ($lastattempt = $DB->get_record_select('scorm_scoes_track', "userid = ? AND scormid = ? AND (value='completed' OR value='passed')", array($userid, $scormid), 'max(attempt) as a')) {
if (empty($lastattempt->a)) {
return '1';
} else {