Skip to content
Permalink
Browse files

Fix QTI import (set correct score) see BT#12777

  • Loading branch information...
jmontoyaa committed Jun 8, 2017
1 parent 1ef40f0 commit c2c9a094828decc37d46b47674747997bc7630f1
Showing with 5 additions and 3 deletions.
  1. +5 −3 main/exercise/export/exercise_import.inc.php
@@ -238,6 +238,7 @@ function import_exercise($file)
$j++;
$matchAnswerIds[$key] = $j;
}
// Answer
$answer->new_answer[$i] = formatText($answers['value']);
// Comment
@@ -251,9 +252,11 @@ function import_exercise($file)
$answer->new_correct[$i] = 0;
}
$answer->new_weighting[$i] = 0;
if (isset($question_array['weighting'][$key])) {
$answer->new_weighting[$i] = $question_array['weighting'][$key];
}
if ($answer->new_correct[$i]) {
$totalCorrectWeight += $answer->new_weighting[$i];
}
@@ -333,7 +336,6 @@ function qti_parse_file($exercisePath, $file, $questionFile)
);
$question_format_supported = true;
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, false);
if ($qtiMainVersion == 1) {
@@ -404,7 +406,7 @@ function startElementQti2($parser, $name, $attributes)
if (sizeof($element_pile) >= 2) {
$parent_element = $element_pile[sizeof($element_pile) - 2];
} else {
$parent_element = "";
$parent_element = '';
}
if ($record_item_body) {
@@ -498,7 +500,7 @@ function startElementQti2($parser, $name, $attributes)
}
break;
case 'MAPENTRY':
if ($parent_element == "MAPPING") {
if ($parent_element == 'MAPPING' || $parent_element == 'MAPENTRY') {
$answer_id = $attributes['MAPKEY'];
if (!isset($exercise_info['question'][$current_question_ident]['weighting'])) {
$exercise_info['question'][$current_question_ident]['weighting'] = array();

0 comments on commit c2c9a09

Please sign in to comment.
You can’t perform that action at this time.