Permalink
Browse files

merging small modifications from head mostly for calculated questions

  • Loading branch information...
1 parent 2dfa65a commit dd9312b2c75ad3e21d4db240d4a82670c4bf3025 pichetp committed May 15, 2007
Showing with 19 additions and 3 deletions.
  1. +19 −3 question/format/webct/format.php
View
22 question/format/webct/format.php
@@ -226,7 +226,7 @@ function readquestions ($lines) {
if (isset($feedbacktext) and is_string($feedbacktext)) {
if (ereg("^:",$line)) {
- $question->feedback[$currentchoice] .= addslashes(trim($feedbacktext));
+ $question->feedback[$currentchoice] = addslashes(trim($feedbacktext));
unset($feedbacktext);
}
else {
@@ -280,18 +280,22 @@ function readquestions ($lines) {
else {
// Create empty feedback array
foreach ($question->answer as $key => $dataanswer) {
- $question->feedback[$key] = ''.$question->feedback[$key];
+ if(!isset( $question->feedback[$key])){
+ $question->feedback[$key] = '';
+ }
}
// this tempgeneralfeedback allows the code to work with versions from 1.6 to 1.9
- // when question->generalfeedback is undefined, the webct feedback is added to each answer
+ // when question->generalfeedback is undefined, the webct feedback is added to each answer feedback
if (isset($question->tempgeneralfeedback)){
if (isset($question->generalfeedback)) {
$question->generalfeedback = $question->tempgeneralfeedback;
} else {
foreach ($question->answer as $key => $dataanswer) {
+ if ($question->tempgeneralfeedback !=''){
$question->feedback[$key] = $question->tempgeneralfeedback.'<br/>'.$question->feedback[$key];
}
}
+ }
unset($question->tempgeneralfeedback);
}
$maxfraction = -1;
@@ -341,6 +345,18 @@ function readquestions ($lines) {
$dataset->itemcount=count($dataset->datasetitem);
}
$question->import_process=TRUE ;
+ unset($question->answer); //not used in calculated question
+ break;
+ case MATCH:
+ if (count($question->answer) < 3){
+ // add a dummy missing question
+ $question->name = 'Dummy question added '.$question->name ;
+ $question->answer[] = 'dummy';
+ $question->subanswers[] = 'dummy';
+ $question->subquestions[] = 'dummy';
+ $question->fraction[] = '0.0';
+ $question->feedback[] = '';
+ }
break;
default:

0 comments on commit dd9312b

Please sign in to comment.