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

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

@ -421,22 +421,13 @@ class learnpath {
FROM '.Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
INNER JOIN '.Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
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__);
$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
{
$max_score = 100;
$random='';
$max_score = 100;
}
if($prerequisites!=0)
@ -453,8 +444,7 @@ class learnpath {
parent_item_id,
previous_item_id,
next_item_id,
display_order,
parameters,
display_order,
prerequisite
) VALUES (
@ -468,8 +458,7 @@ class learnpath {
" . $parent . ",
" . $previous . ",
" . $next . ",
" . ($display_order + 1) . ",
" .$random.",
" . ($display_order + 1) . ",
" . $prerequisites . "
)";
}
@ -487,8 +476,7 @@ class learnpath {
max_score,
parent_item_id,
previous_item_id,
next_item_id,
parameters,
next_item_id,
display_order
) VALUES (
" . $this->get_id() . ",
@ -501,7 +489,6 @@ class learnpath {
" . $parent . ",
" . $previous . ",
" . $next . ",
" .$random.",
" . ($display_order + 1) . "
)";
}

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

Loading…
Cancel
Save