Skip to content
Browse files

Turns out that the question text is not a required field.

Also fixed warning in essay questions.
  • Loading branch information...
1 parent fb3557d commit d03d9d7a5acc2a6b902ec4f386893f9247a57708 thepurpleblob committed
Showing with 3 additions and 7 deletions.
  1. +3 −7 question/format/xml/format.php
View
10 question/format/xml/format.php
@@ -142,7 +142,7 @@ function import_headers( $question ) {
// question name
$qo->name = $this->getpath( $question, array('#','name',0,'#','text',0,'#'), '', true, $error_noname );
- $qo->questiontext = $this->getpath( $question, array('#','questiontext',0,'#','text',0,'#'), '', true, $error_noquestion );
+ $qo->questiontext = $this->getpath( $question, array('#','questiontext',0,'#','text',0,'#'), '', true );
$qo->questiontextformat = $this->getpath( $question, array('#','questiontext',0,'@','format'), '' );
$image = $this->getpath( $question, array('#','image',0,'#'), $qo->image );
$image_base64 = $this->getpath( $question, array('#','image_base64','0','#'),'' );
@@ -458,12 +458,8 @@ function import_essay( $question ) {
$answer = $question['#']['answer'][0];
// get fraction - <fraction> tag is deprecated
- if (!empty($answer['#']['fraction'][0]['#'])) {
- $qo->fraction = $answer['#']['fraction'][0]['#'];
- }
- else {
- $qo->fraction = $answer['@']['fraction'] / 100;
- }
+ $qo->fraction = $this->getpath( $question, array('@','fraction'), 0 ) / 100;
+ $q0->fraction = $this->getpath( $question, array('#','fraction',0,'#'), $qo->fraction );
return $qo;
}

0 comments on commit d03d9d7

Please sign in to comment.
Something went wrong with that request. Please try again.