Skip to content
Snippets Groups Projects
Commit e76c6e29 authored by Sivaji Ganesh Jojodae's avatar Sivaji Ganesh Jojodae
Browse files

Fixed Matching Question scoring problem.

parent 9ecd9f6b
No related branches found
No related tags found
No related merge requests found
......@@ -234,6 +234,7 @@ class MatchingResponse extends AbstractQuizQuestionResponse {
$this->rid = $rid;
$this->question = $question;
$this->answer = $answer;
$this->is_correct = $this->score();
}
public function save() {
......@@ -258,9 +259,7 @@ class MatchingResponse extends AbstractQuizQuestionResponse {
//print_r($correct_answers);
//echo "-------------------------\n\n\n";
foreach ($user_answers as $key => $value) {
if ($key == $value) {
$this->score++;
}
$this->score = ($key == $value) ? 1 : 0;
}
return $this->score;
}
......
......@@ -174,7 +174,6 @@ function quiz_question_form(&$node, $form_state) {
'#value' => $quiz->vid,
);
}
//print_r($node);exit;
$question = _quiz_question_get_instance($node);
$form = array_merge($form, $question->getCreationForm($form_state));
......
......@@ -1092,6 +1092,8 @@ function quiz_take_quiz($quiz) {
$module = $types[$former_question->type]['module'];
//drupal_set_message($module . ' evaluate_question called');
$result = module_invoke($module, 'evaluate_question', $former_question, $_SESSION['quiz_'. $quiz->nid]['result_id']);
//$result stdClass Object ( [score] => 0 [nid] => 3 [vid] => 3 [rid] => 27 [is_correct] => [is_evaluated] => 1 [is_skipped] => )
quiz_store_question_result($result, array('set_msg' => TRUE));
// Stash feedback in the session, since the $_POST gets cleared.
......
......@@ -498,7 +498,7 @@ function theme_quiz_feedback($questions, $showpoints = TRUE, $showfeedback = FAL
$cols[] = array('data' => $report, 'class' => 'quiz_summary_qrow');
// Get the score result for each question only if it's a scored quiz.
if ($showpoints && $question->type != 'matching') {
if ($showpoints) {
$theme = ($question->correct) ? 'quiz_score_correct' : 'quiz_score_incorrect';
$cols[] = array('data' => theme($theme), 'class' => 'quiz_summary_qcell');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment