From 95e42912a73e94f78e95a1d1260769aab6e9dfd8 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 25 Mar 2004 15:07:14 +0000 Subject: [PATCH] Fix to detect the different ANSWER format used for Shortanswers bug 1182 --- mod/quiz/format/webct/format.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mod/quiz/format/webct/format.php b/mod/quiz/format/webct/format.php index d1269f0f6d..10c168d083 100644 --- a/mod/quiz/format/webct/format.php +++ b/mod/quiz/format/webct/format.php @@ -151,7 +151,7 @@ class quiz_file_format extends quiz_default_format { $errors[] = get_string("missingquestion", "quiz", $nQuestionStartLine); $QuestionOK = FALSE; } - if (empty($question->answer)) { // a question must have at least 1 answer + if (sizeof($question->answer) < 1) { // a question must have at least 1 answer $errors[] = get_string("missinganswer", "quiz", $nQuestionStartLine); $QuestionOK = FALSE; } @@ -303,6 +303,13 @@ class quiz_file_format extends quiz_default_format { continue; } + if (eregi("^:ANSWER([0-9]+):([^:]+):([0-9\.]+):(.*)",$line,$webct_options)) { /// SHORTANSWER + $currentchoice=$webct_options[1]; + $answertext=$webct_options[2]; // Start gathering next lines + $question->fraction[$currentchoice]=($webct_options[3]/100); + continue; + } + if (eregi("^:L([0-9]+)",$line,$webct_options)) { $answertext=""; // Start gathering next lines $currentchoice=$webct_options[1]; -- 2.39.5