[svn r14300] fix bugs in matching question (appearing in some particular cases)

FS#2228
skala
Eric Marguin 17 years ago
parent e51e2781ad
commit 9c8e481f06
  1. 4
      main/exercice/exercise_result.php
  2. 25
      main/exercice/exercise_show.php

@ -25,7 +25,7 @@
* @package dokeos.exercise
* @author Olivier Brouckaert, main author
* @author Roan Embrechts, some refactoring
* @version $Id: exercise_result.php 13988 2007-12-14 05:05:51Z yannoo $
* @version $Id: exercise_result.php 14300 2008-02-15 11:40:43Z elixir_inter $
*
* @todo split more code up in functions, move functions to library?
*/
@ -777,7 +777,7 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
$val = $arr1[1][0];
$val=addslashes($val);
$val=strip_tags($val);
$sql = "select position from $table_ans where question_id=$questionId and answer='$val'";
$sql = "select position from $table_ans where question_id=$questionId and answer='$val' AND correct=0";
$res = api_sql_query($sql, __FILE__, __LINE__);
$answer = mysql_result($res,0,"position");

@ -648,21 +648,22 @@ $result =api_sql_query($query, __FILE__, __LINE__);
$i_answer_correct_answer = $a_answers['correct'];
$i_answer_position = $a_answers['position'];
$sql_user_answer = 'SELECT answers.answer
FROM '.$table_ans.' as answers
INNER JOIN '.$TBL_TRACK_ATTEMPT.' as track_e_attempt
ON track_e_attempt.answer=answers.position
AND track_e_attempt.position="'.$i_answer_position.'"
AND exe_id = "'.$id.'"
WHERE answers.question_id ="'.$questionId.'"
AND correct=0';
$sql_user_answer =
'SELECT answers.answer
FROM '.$TBL_TRACK_ATTEMPT.' as track_e_attempt
INNER JOIN '.$table_ans.' as answers
ON answers.position = track_e_attempt.answer
AND track_e_attempt.question_id=answers.question_id
WHERE answers.correct = 0
AND track_e_attempt.exe_id = "'.$id.'"
AND track_e_attempt.question_id = "'.$questionId.'"
AND track_e_attempt.position="'.$i_answer_position.'"';
$res_user_answer = api_sql_query($sql_user_answer, __FILE__, __LINE__);
$s_user_answer = mysql_result($res_user_answer,0,0);
$sql_correct_answer = 'SELECT answer FROM '.$table_ans.' WHERE position = "'.$i_answer_correct_answer.'" AND question_id="'.$questionId.'"';
$res_correct_answer = api_sql_query($sql_correct_answer, __FILE__, __LINE__);
$s_correct_answer = mysql_result($res_correct_answer,0,0);
$s_correct_answer = $s_answer_label;
$i_answerWeighting=$objAnswerTmp->selectWeighting($i_answer_id);

Loading…
Cancel
Save