@ -870,30 +870,10 @@ class learnpathItem{
function get_score(){
if($this->debug>0){error_log('New LP - In learnpathItem::get_score()',0);}
$res = 0;
if($this->type == 'quiz'){
//get score directly from db and update current
$item_view_table = Database::get_course_table('lp_item_view');
$check = "SELECT * FROM $item_view_table " .
"WHERE lp_item_id = ".$this->db_id. " " .
"AND lp_view_id = ".$this->view_id. " ".
"AND view_count = ".$this->get_attempt_id();
$resq = api_sql_query($check,__FILE__,__LINE__);
if(Database::num_rows($resq)>0){
$row = Database::fetch_array($resq);
if(!empty($row['score'])){
//update current object score
$this->current_score = $row['score'];
$res = $this->current_score;
}
}
}else{
if(!empty($this->current_score))
{
$res = $this->current_score;
}
}
//TODO check this return value is valid for children classes (SCORM?)
if(!empty($this->current_score))
{
$res = $this->current_score;
}
if($this->debug>1){error_log('New LP - Out of learnpathItem::get_score() - returning '.$res,0);}
return $res;
}
@ -1617,7 +1597,6 @@ class learnpathItem{
}
break;
case TOOL_HOTPOTATOES:
break;
case TOOL_QUIZ:
default:
//for now, everything that is not sco and not asset is set to
@ -2069,6 +2048,7 @@ class learnpathItem{
$sql = "UPDATE $item_view_table " .
"SET total_time = ".$this->get_total_time().", " .
" start_time = ".$this->get_current_start_time().", " .
" score = ".$this->get_score().", " .
" status = '".$this->get_status(false)."'," .
" max_score = '".$this->get_max()."'," .
" suspend_data = '".Database::escape_string($this->current_data)."'," .