[svn r16015] "Parameters" field value avoided in Lp_item, we use instead the Quiz Random value (see FS#2785)

skala
Julio Montoya 18 years ago
parent 28176959a1
commit 78d00b11ca
  1. 13
      main/newscorm/learnpath.class.php
  2. 20
      main/newscorm/lp_stats.php

@ -422,21 +422,12 @@ class learnpath {
INNER JOIN '.Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question INNER JOIN '.Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
ON quiz_question.id = quiz_rel_question.question_id ON quiz_question.id = quiz_rel_question.question_id
AND quiz_rel_question.exercice_id = '.$id; AND quiz_rel_question.exercice_id = '.$id;
$rsQuiz = api_sql_query($sql, __FILE__, __LINE__); $rsQuiz = api_sql_query($sql, __FILE__, __LINE__);
$max_score = Database::result($rsQuiz, 0, 0); $max_score = Database::result($rsQuiz, 0, 0);
$sql = 'SELECT random
FROM '.Database :: get_course_table(TABLE_QUIZ_TEST).' as quiz
WHERE quiz.id = '.$id;
$rsQuizRand = api_sql_query($sql, __FILE__, __LINE__);
$random = Database::result($rsQuizRand, 0, 0);
} }
else else
{ {
$max_score = 100; $max_score = 100;
$random='';
} }
if($prerequisites!=0) if($prerequisites!=0)
@ -454,7 +445,6 @@ class learnpath {
previous_item_id, previous_item_id,
next_item_id, next_item_id,
display_order, display_order,
parameters,
prerequisite prerequisite
) VALUES ( ) VALUES (
@ -469,7 +459,6 @@ class learnpath {
" . $previous . ", " . $previous . ",
" . $next . ", " . $next . ",
" . ($display_order + 1) . ", " . ($display_order + 1) . ",
" .$random.",
" . $prerequisites . " " . $prerequisites . "
)"; )";
} }
@ -488,7 +477,6 @@ class learnpath {
parent_item_id, parent_item_id,
previous_item_id, previous_item_id,
next_item_id, next_item_id,
parameters,
display_order display_order
) VALUES ( ) VALUES (
" . $this->get_id() . ", " . $this->get_id() . ",
@ -501,7 +489,6 @@ class learnpath {
" . $parent . ", " . $parent . ",
" . $previous . ", " . $previous . ",
" . $next . ", " . $next . ",
" .$random.",
" . ($display_order + 1) . " " . ($display_order + 1) . "
)"; )";
} }

@ -140,6 +140,8 @@ if($export_csv)
); );
} }
$TBL_QUIZ = Database :: get_course_table('quiz');
foreach ($list as $my_item_id) foreach ($list as $my_item_id)
{ {
$extend_this = 0; $extend_this = 0;
@ -157,14 +159,15 @@ foreach ($list as $my_item_id)
"i.title as mytitle, i.max_score as mymaxscore, " . "i.title as mytitle, i.max_score as mymaxscore, " .
"iv.max_score as myviewmaxscore, " . "iv.max_score as myviewmaxscore, " .
"i.item_type as item_type, iv.view_count as iv_view_count, " . "i.item_type as item_type, iv.view_count as iv_view_count, " .
"iv.id as iv_id, path as path, i.parameters". "iv.id as iv_id, path as path, q.random".
" FROM $TBL_LP_ITEM as i, $TBL_LP_ITEM_VIEW as iv, $TBL_LP_VIEW as v ". " FROM $TBL_LP_ITEM as i, $TBL_LP_ITEM_VIEW as iv, $TBL_LP_VIEW as v, $TBL_QUIZ as q".
" WHERE i.id = iv.lp_item_id ". " WHERE i.id = iv.lp_item_id ".
" AND i.id = $my_item_id ". " AND i.id = $my_item_id ".
" AND iv.lp_view_id = v.id ". " AND iv.lp_view_id = v.id ".
" AND i.lp_id = $lp_id ". " AND i.lp_id = $lp_id ".
" AND v.user_id = ".$user_id." ". " AND v.user_id = ".$user_id." ".
" AND v.view_count = $view ". " AND v.view_count = $view ".
" AND q.id = path ".
" ORDER BY iv.view_count $qry_order "; " ORDER BY iv.view_count $qry_order ";
} }
else else
@ -174,13 +177,14 @@ foreach ($list as $my_item_id)
"i.title as mytitle, i.max_score as mymaxscore, " . "i.title as mytitle, i.max_score as mymaxscore, " .
"iv.max_score as myviewmaxscore, " . "iv.max_score as myviewmaxscore, " .
"i.item_type as item_type, iv.view_count as iv_view_count, " . "i.item_type as item_type, iv.view_count as iv_view_count, " .
"iv.id as iv_id, path as path, i.parameters". "iv.id as iv_id, path as path, q.random".
" FROM $TBL_LP_ITEM as i, $TBL_LP_ITEM_VIEW as iv, $TBL_LP_VIEW as v ". " FROM $TBL_LP_ITEM as i, $TBL_LP_ITEM_VIEW as iv, $TBL_LP_VIEW as v, $TBL_QUIZ as q".
" WHERE i.id = iv.lp_item_id ". " WHERE i.id = iv.lp_item_id ".
" AND i.id = $my_item_id ". " AND i.id = $my_item_id ".
" AND iv.lp_view_id = v.id ". " AND iv.lp_view_id = v.id ".
" AND i.lp_id = $lp_id ". " AND i.lp_id = $lp_id ".
" AND v.user_id = ".$user_id." ". " AND v.user_id = ".$user_id." ".
" AND q.id = path ".
" ORDER BY iv.view_count $qry_order "; " ORDER BY iv.view_count $qry_order ";
} }
@ -322,8 +326,8 @@ foreach ($list as $my_item_id)
} }
else else
{ {
// the parameters value is fill with the random value from the table QUIZ is empty or has a value that indicates the quantity of random questions // random value from the table QUIZ is empty or has a value that indicates the quantity of random questions
if ($row['parameters'] != '' && $row['parameters']!=0 ) if ($row['random'] != '' && $row['random']!=0 )
{ {
$maxscore = $row['myviewmaxscore']; $maxscore = $row['myviewmaxscore'];
} }
@ -456,8 +460,8 @@ foreach ($list as $my_item_id)
} }
else else
{ {
// the parameters value is fill with the random value from the table QUIZ is empty or has a value that indicates the quantity of random questions // random value from the table QUIZ is empty or has a value that indicates the quantity of random questions
if ($row['parameters'] != '' && $row['parameters']!=0 ) if ($row['random'] != '' && $row['random']!=0 )
{ {
$maxscore = $row['myviewmaxscore']; $maxscore = $row['myviewmaxscore'];
} }

Loading…
Cancel
Save