[svn r14827] reporting : fix some bugs when calculation scores (FS#2443)

skala
Eric Marguin 17 years ago
parent e08252ca8b
commit a1bce80518
  1. 5
      main/inc/lib/tracking.lib.php
  2. 9
      main/mySpace/myStudents.php

@ -322,9 +322,11 @@ class Tracking {
//We get the last view id of this LP //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).'"'; $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__); $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; $total_score = $total_weighting = 0;
if($lp_view_id!=0)
{
while($item = Database :: fetch_array($rsItems, 'ASSOC')) while($item = Database :: fetch_array($rsItems, 'ASSOC'))
{ {
$sql = 'SELECT score as student_score $sql = 'SELECT score as student_score
@ -343,6 +345,7 @@ class Tracking {
$lp_scorm_weighting_total+=100; $lp_scorm_weighting_total+=100;
} }
} }
}
} }
} }

@ -1,4 +1,4 @@
<?php //$Id: myStudents.php 14818 2008-04-09 22:33:57Z yannoo $ <?php //$Id: myStudents.php 14827 2008-04-10 08:22:32Z elixir_inter $
/* /*
============================================================================== ==============================================================================
Dokeos - elearning and course management software Dokeos - elearning and course management software
@ -614,20 +614,21 @@ if(!empty($_GET['student']))
} }
$total_score = $total_weighting = 0; $total_score = $total_weighting = 0;
if($lp_view_id)
{
while($item = Database :: fetch_array($rsItems, 'ASSOC')) while($item = Database :: fetch_array($rsItems, 'ASSOC'))
{ {
$sql = 'SELECT score as student_score $sql = 'SELECT score as student_score
FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' as lp_view_item FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' as lp_view_item
WHERE lp_view_item.lp_item_id = '.$item['item_id'].' WHERE lp_view_item.lp_item_id = '.$item['item_id'].'
AND lp_view_id = "'.$lp_view_id.'" AND lp_view_id = "'.$lp_view_id.'"';
';
$rsScores = api_sql_query($sql, __FILE__, __LINE__); $rsScores = api_sql_query($sql, __FILE__, __LINE__);
$total_score += mysql_result($rsScores, 0, 0); $total_score += mysql_result($rsScores, 0, 0);
$total_weighting += $item['max_score']; $total_weighting += $item['max_score'];
}
$any_result = true; $any_result = true;
} }
$sql = 'SELECT id, max_score $sql = 'SELECT id, max_score
FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_item.' AS lp_item FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_item.' AS lp_item
WHERE lp_id='.$a_learnpath['id'].' WHERE lp_id='.$a_learnpath['id'].'

Loading…
Cancel
Save