diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index 23f5b90524..45f1554e08 100644 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -322,26 +322,29 @@ class Tracking { //We get the last view id of this LP $sql='SELECT max(id) as id FROM '.$lp_view_table.' WHERE lp_id='.$a_learnpath['id'].' AND user_id="'.intval($student_id).'"'; $rs_last_lp_view_id = api_sql_query($sql, __FILE__, __LINE__); - $lp_view_id = mysql_result($rs_last_lp_view_id,0,'id'); + $lp_view_id = intval(mysql_result($rs_last_lp_view_id,0,'id')); $total_score = $total_weighting = 0; - while($item = Database :: fetch_array($rsItems, 'ASSOC')) + if($lp_view_id!=0) { - $sql = 'SELECT score as student_score - FROM '.$lp_item_view_table.' as lp_view_item - WHERE lp_view_item.lp_item_id = '.$item['item_id'].' - AND lp_view_id = "'.$lp_view_id.'" - '; - - $rsScores = api_sql_query($sql, __FILE__, __LINE__); - if(Database::num_rows($rsScores)>0) + while($item = Database :: fetch_array($rsItems, 'ASSOC')) { - $total_score += mysql_result($rsScores, 0, 0); - $total_weighting += $item['max_score']; - - $lp_scorm_score_total += ($total_score/$total_weighting)*100; - $lp_scorm_weighting_total+=100; - } + $sql = 'SELECT score as student_score + FROM '.$lp_item_view_table.' as lp_view_item + WHERE lp_view_item.lp_item_id = '.$item['item_id'].' + AND lp_view_id = "'.$lp_view_id.'" + '; + + $rsScores = api_sql_query($sql, __FILE__, __LINE__); + if(Database::num_rows($rsScores)>0) + { + $total_score += mysql_result($rsScores, 0, 0); + $total_weighting += $item['max_score']; + + $lp_scorm_score_total += ($total_score/$total_weighting)*100; + $lp_scorm_weighting_total+=100; + } + } } } diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index 6daf4cec51..e817a3531f 100644 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -1,4 +1,4 @@ -