MDL-15859 [PATCH] Fixes for tests of '' on Oracle.

This commit is contained in:
piers 2008-08-15 03:30:05 +00:00
parent d85b412960
commit 6280b17adb
3 changed files with 7 additions and 5 deletions

View File

@ -493,7 +493,7 @@ function scorm_grade_item_update($scorm, $grades=NULL) {
$params = array('itemname'=>$scorm->name, 'idnumber'=>$scorm->cmidnumber);
if (($scorm->grademethod % 10) == 0) { // GRADESCOES
if ($maxgrade = $DB->count_records_select('scorm_scoes',"scorm=? AND launch<>''", array($scorm->id))) {
if ($maxgrade = $DB->count_records_select('scorm_scoes', 'scorm = ? AND launch <> ?', array($scorm->id, ''))) {
$params['gradetype'] = GRADE_TYPE_VALUE;
$params['grademax'] = $maxgrade;
$params['grademin'] = 0;

View File

@ -40,7 +40,7 @@
if ($sco = scorm_get_sco($scoid)) {
if ($sco->launch == '') {
// Search for the next launchable sco
if ($scoes = $DB->get_records_select('scorm_scoes',"scorm=? AND launch<>'' AND id>?",array($scorm->id, $sco->id), 'id ASC')) {
if ($scoes = $DB->get_records_select('scorm_scoes',"scorm = ? AND launch <> ? AND id > ?",array($scorm->id, '', $sco->id), 'id ASC')) {
$sco = current($scoes);
}
}
@ -50,7 +50,7 @@
// If no sco was found get the first of SCORM package
//
if (!isset($sco)) {
$scoes = $DB->get_records_select('scorm_scoes',"scorm=? AND launch<>''", array($scorm->id),'id ASC');
$scoes = $DB->get_records_select('scorm_scoes',"scorm = ? AND launch <> ?", array($scorm->id, ''),'id ASC');
$sco = current($scoes);
}

View File

@ -462,7 +462,8 @@ function scorm_count_launchable($scormid,$organization='') {
$sqlorganization = " AND organization=?";
$params[] = $organization;
}
return $DB->count_records_select('scorm_scoes',"scorm=$scormid $sqlorganization AND launch<>''", $params);
$params []= ''; // empty launch
return $DB->count_records_select('scorm_scoes',"scorm = ? $sqlorganization AND launch <> ?", $params);
}
function scorm_get_last_attempt($scormid, $userid) {
@ -617,12 +618,13 @@ function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') {
</div>
<?php
}
function scorm_simple_play($scorm,$user) {
global $DB;
$result = false;
$scoes = $DB->get_records_select('scorm_scoes', 'scorm=? AND launch<>\'\'', array($scorm->id));
$scoes = $DB->get_records_select('scorm_scoes', 'scorm = ? AND launch <> ?', array($scorm->id, ''));
if ($scoes && (count($scoes) == 1)) {
if ($scorm->skipview >= 1) {