Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-28349 error when GIFT-importing essay questions.

  • Loading branch information...
commit 7f10fbbf5f9b16b2405d2a1e2dc88b9d7b0c863a 1 parent 3a5778e
@timhunt timhunt authored
View
9 question/format/gift/format.php
@@ -317,10 +317,11 @@ public function readquestion($lines) {
return $question;
case ESSAY:
- $question->fraction = 0;
- $question->feedback['text'] = '';
- $question->feedback['format'] = $question->questiontextformat;
- $question->feedback['files'] = array();
+ $question->responseformat = 'editor';
+ $question->responsefieldlines = 15;
+ $question->attachments = 0;
+ $question->graderinfo = array(
+ 'text' => '', 'format' => FORMAT_HTML, 'files' => array());
return $question;
case MULTICHOICE:
View
48 question/format/gift/simpletest/fixtures/questions.gift.txt
@@ -0,0 +1,48 @@
+// essay
+::Q8:: How are you? {}
+
+// question: 2 name: Moodle activities
+::Moodle activities::[html]Match the <b>activity</b> to the description.{
+ =[html]An activity supporting asynchronous discussions. -> Forum
+ =[moodle]A teacher asks a question and specifies a choice of multiple responses. -> Choice
+ =[plain]A bank of record entries which participants can add to. -> Database
+ =[markdown]A collection of web pages that anyone can add to or edit. -> Wiki
+ = -> Chat
+}
+
+// multiple choice with specified feedback for right and wrong answers
+::Q2:: What's between orange and green in the spectrum?
+{
+ =yellow # right; good!
+ ~red # [html]wrong, it's yellow
+ ~[plain]blue # wrong, it's yellow
+}
+
+// multiple choice, multiple response with specified feedback for right and wrong answers
+::colours:: What's between orange and green in the spectrum?
+{
+ ~%50%yellow # right; good!
+ ~%-100%red # [html]wrong
+ ~%50%off-beige # right; good!
+ ~%-100%[plain]blue # wrong
+}
+
+// math range question
+::Q5:: What is a number from 1 to 5? {#3:2~#Completely wrong}";
+
+// question: 666 name: Shortanswer
+::Shortanswer::Which is the best animal?{
+ =Frog#Good!
+ =%50%Cat#What is it with Moodlers and cats?
+ =%0%*#Completely wrong
+}
+
+// true/false
+::Q1:: 42 is the Absolute Answer to everything.{
+FALSE#42 is the Ultimate Answer.#You gave the right answer.}";
+
+// name 0-11
+::2-08 TSL::TSL is blablabla.{T}
+
+// name 0-11
+::2-08 TSL::TSL is blablabla.{TRUE}
View
25 question/format/gift/simpletest/testgiftformat.php
@@ -62,11 +62,13 @@ public function test_import_essay() {
'defaultmark' => 1,
'penalty' => 0.3333333,
'length' => 1,
- 'feedback' => array(
+ 'responseformat' => 'editor',
+ 'responsefieldlines' => 15,
+ 'attachments' => 0,
+ 'graderinfo' => array(
'text' => '',
- 'format' => FORMAT_MOODLE,
- 'files' => array(),
- ),
+ 'format' => FORMAT_HTML,
+ 'files' => array()),
);
$this->assert(new CheckSpecifiedFieldsExpectation($expectedq), $q);
@@ -85,16 +87,11 @@ public function test_export_essay() {
'length' => 1,
'qtype' => 'essay',
'options' => (object) array(
- 'answers' => array(
- 123 => (object) array(
- 'id' => 123,
- 'answer' => 666,
- 'answerformat' => FORMAT_MOODLE,
- 'fraction' => 0,
- 'feedback' => '',
- 'feedbackformat' => FORMAT_MOODLE,
- ),
- ),
+ 'responseformat' => 'editor',
+ 'responsefieldlines' => 15,
+ 'attachments' => 0,
+ 'graderinfo' => '',
+ 'graderinfoformat' => FORMAT_HTML,
),
);
Please sign in to comment.
Something went wrong with that request. Please try again.