[svn r12986] fiw a bug with tracking : we didn't call learnpath::get_db_progress()

skala
Eric Marguin 18 years ago
parent 7c8038aedb
commit 1f009fe071
  1. 28
      main/auth/my_progress.php

@ -6,6 +6,7 @@ $cidReset = true;
require ('../inc/global.inc.php'); require ('../inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH).'tracking.lib.php'); require_once (api_get_path(LIBRARY_PATH).'tracking.lib.php');
require_once ('../newscorm/learnpath.class.php');
$nameTools=get_lang('MyProgress'); $nameTools=get_lang('MyProgress');
@ -216,28 +217,9 @@ foreach($Courses as $enreg)
{ {
while($a_learnpath = mysql_fetch_array($resultLearnpath)) while($a_learnpath = mysql_fetch_array($resultLearnpath))
{ {
$sqlProgress = "SELECT COUNT(DISTINCT lp_item_id) AS nbItem
FROM ".$a_infosCours['db_name'].".".$tbl_course_lp_view_item." AS item_view
INNER JOIN ".$a_infosCours['db_name'].".".$tbl_course_lp_view." AS view $progress = learnpath :: get_db_progress($a_learnpath['id'],$_user['user_id'], '%',$a_infosCours['db_name']);
ON item_view.lp_view_id = view.id
AND view.lp_id = ".$a_learnpath['id']."
AND view.user_id = ".$_user['user_id']."
WHERE item_view.status = 'completed' OR item_view.status = 'passed'
";
$resultProgress = api_sql_query($sqlProgress);
$a_nbItem = mysql_fetch_array($resultProgress);
$sqlTotalItem = " SELECT COUNT(item_type) AS totalItem
FROM ".$a_infosCours['db_name'].".".$tbl_course_lp_item."
WHERE lp_id = ".$a_learnpath['id']."
AND item_type != 'chapter'
AND item_type != 'dokeos_chapter'
AND item_type != 'dir'"
;
$resultItem = api_sql_query($sqlTotalItem);
$a_totalItem = mysql_fetch_array($resultItem);
$progress = round(($a_nbItem['nbItem'] * 100)/$a_totalItem['totalItem']);
// calculates last connection time // calculates last connection time
@ -272,7 +254,7 @@ foreach($Courses as $enreg)
echo " </td> echo " </td>
<td align='center'> <td align='center'>
"; ";
echo $progress.'%'; echo $progress;
echo " </td> echo " </td>
<td align='center'> <td align='center'>
"; ";

Loading…
Cancel
Save