[svn r16000] MULTIPLE question bug fixed - (see FS#2795)

skala
Julio Montoya 17 years ago
parent 9d478c671a
commit d1a817fe3c
  1. 23
      main/exercice/exercise_result.php
  2. 4
      main/exercice/exercise_show.php

@ -29,7 +29,7 @@
* @author Olivier Brouckaert, main author
* @author Roan Embrechts, some refactoring
* @author Julio Montoya Armas switchable fill in blank option added
* @version $Id: exercise_result.php 15967 2008-08-10 06:40:40Z yannoo $
* @version $Id: exercise_result.php 16000 2008-08-15 04:26:07Z juliomontoya $
*
* @todo split more code up in functions, move functions to library?
*/
@ -438,6 +438,9 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
$counter++;
// gets the student choice for this question
$choice=$exerciseResult[$questionId];
//print_r($choice); echo "<br>";
// creates a temporary Question object
$objQuestionTmp = Question :: read($questionId);
@ -950,12 +953,20 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
$choice = 0;
}
if ($answerType==MULTIPLE_ANSWER )
{
$reply = array_keys($choice);
for ($i=0;$i<sizeof($reply);$i++)
{
if ($choice != 0)
{
$reply = array_keys($choice);
for ($i=0;$i<sizeof($reply);$i++)
{
$ans = $reply[$i];
exercise_attempt($questionScore,$ans,$quesId,$exeId,$i);
}
}
else
{
$ans = $reply[$i];
exercise_attempt($questionScore,$ans,$quesId,$exeId,$i);
exercise_attempt($questionScore, 0 ,$quesId,$exeId,0);
}
}
elseif ($answerType==MATCHING)

@ -348,7 +348,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$exerciseDexcription=mysql_result($result,0,1);
$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($_user['user_id'])." ";
$query = "select * from ".$TBL_TRACK_ATTEMPT." as attempts
$query = "select attempts.question_id, answer from ".$TBL_TRACK_ATTEMPT." as attempts
INNER JOIN ".$TBL_TRACK_EXERCICES." as stats_exercices ON stats_exercices.exe_id=attempts.exe_id
INNER JOIN ".$TBL_EXERCICE_QUESTION." as quizz_rel_questions ON quizz_rel_questions.exercice_id=stats_exercices.exe_exo_id AND quizz_rel_questions.question_id = attempts.question_id
INNER JOIN ".$TBL_QUESTIONS." as questions ON questions.id=quizz_rel_questions.question_id
@ -356,7 +356,6 @@ $query = "select * from ".$TBL_TRACK_ATTEMPT." as attempts
GROUP BY quizz_rel_questions.question_order, attempts.question_id";
//GROUP BY questions.position, attempts.question_id";
$result =api_sql_query($query, __FILE__, __LINE__);
?>
@ -397,6 +396,7 @@ $result =api_sql_query($query, __FILE__, __LINE__);
$questionList[] = $row['question_id'];
$exerciseResult[] = $row['answer'];
}
//echo '<pre>';print_R($questionList);
foreach($questionList as $questionId)
{
$counter++;

Loading…
Cancel
Save