|
|
|
@ -4272,21 +4272,21 @@ class Exercise |
|
|
|
|
if ($final_answer == 0) { |
|
|
|
|
$questionScore = 0; |
|
|
|
|
} |
|
|
|
|
saveExerciseAttempt($questionScore, 1, $quesId, $exeId, 0); // we always insert the answer_id 1 = delineation |
|
|
|
|
saveQuestionAttempt($questionScore, 1, $quesId, $exeId, 0); // we always insert the answer_id 1 = delineation |
|
|
|
|
//in delineation mode, get the answer from $hotspot_delineation_result[1] |
|
|
|
|
saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList(1), $hotspot_delineation_result[1], $exerciseResultCoordinates[$quesId]); |
|
|
|
|
} else { |
|
|
|
|
if ($final_answer == 0) { |
|
|
|
|
$questionScore = 0; |
|
|
|
|
$answer = 0; |
|
|
|
|
saveExerciseAttempt($questionScore, $answer, $quesId, $exeId, 0); |
|
|
|
|
saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
|
|
|
|
if (is_array($exerciseResultCoordinates[$quesId])) { |
|
|
|
|
foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
|
|
|
saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList($idx), 0, $val); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
saveExerciseAttempt($questionScore, $answer, $quesId, $exeId, 0); |
|
|
|
|
saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
|
|
|
|
if (is_array($exerciseResultCoordinates[$quesId])) { |
|
|
|
|
foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
|
|
|
saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList($idx), $choice[$idx], $val); |
|
|
|
@ -4349,13 +4349,13 @@ class Exercise |
|
|
|
|
$reply = array_keys($choice); |
|
|
|
|
for ($i = 0; $i < sizeof($reply); $i++) { |
|
|
|
|
$ans = $reply[$i]; |
|
|
|
|
saveExerciseAttempt($questionScore, $ans.':'.$choice[$ans], $quesId, $exeId, $i, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, $ans.':'.$choice[$ans], $quesId, $exeId, $i, $this->id); |
|
|
|
|
if ($debug) { |
|
|
|
|
error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
saveExerciseAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id); |
|
|
|
|
} |
|
|
|
|
} elseif ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
|
|
|
|
if ($choice != 0) { |
|
|
|
@ -4366,46 +4366,46 @@ class Exercise |
|
|
|
|
} |
|
|
|
|
for ($i = 0; $i < sizeof($reply); $i++) { |
|
|
|
|
$ans = $reply[$i]; |
|
|
|
|
saveExerciseAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
saveExerciseAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id); |
|
|
|
|
} |
|
|
|
|
} elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
|
|
|
|
if ($choice != 0) { |
|
|
|
|
$reply = array_keys($choice); |
|
|
|
|
for ($i = 0; $i < sizeof($reply); $i++) { |
|
|
|
|
$ans = $reply[$i]; |
|
|
|
|
saveExerciseAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
saveExerciseAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id); |
|
|
|
|
} |
|
|
|
|
} elseif ($answerType == MATCHING || $answerType == DRAGGABLE) { |
|
|
|
|
if (isset($matching)) { |
|
|
|
|
foreach ($matching as $j => $val) { |
|
|
|
|
saveExerciseAttempt($questionScore, $val, $quesId, $exeId, $j, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, $val, $quesId, $exeId, $j, $this->id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} elseif ($answerType == FREE_ANSWER) { |
|
|
|
|
$answer = $choice; |
|
|
|
|
saveExerciseAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
|
|
|
} elseif ($answerType == ORAL_EXPRESSION) { |
|
|
|
|
$answer = $choice; |
|
|
|
|
saveExerciseAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $nano); |
|
|
|
|
saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $nano); |
|
|
|
|
} elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_IMAGE || $answerType == UNIQUE_ANSWER_NO_OPTION) { |
|
|
|
|
$answer = $choice; |
|
|
|
|
saveExerciseAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
|
|
|
// } elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) { |
|
|
|
|
} elseif ($answerType == HOT_SPOT) { |
|
|
|
|
saveExerciseAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
|
|
|
if (isset($exerciseResultCoordinates[$questionId]) && !empty($exerciseResultCoordinates[$questionId])) { |
|
|
|
|
foreach ($exerciseResultCoordinates[$questionId] as $idx => $val) { |
|
|
|
|
saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList($idx), $choice[$idx], $val, $this->id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
saveExerciseAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
|
|
|
saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|