]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10819:
authorthepurpleblob <thepurpleblob>
Mon, 20 Aug 2007 10:36:30 +0000 (10:36 +0000)
committerthepurpleblob <thepurpleblob>
Mon, 20 Aug 2007 10:36:30 +0000 (10:36 +0000)
GIFT now exports grade fractions for numeric questions

Merged from STABLE_18

question/format/gift/format.php

index a9844bb75a419fcdca48430e92effb1c96d4d370..b6a722e0eb3da5423dd0a5e3a18976cbaf297594 100755 (executable)
@@ -616,7 +616,12 @@ function writequestion( $question ) {
         $expout .= "::".$this->repchar($question->name)."::".$tfname.$this->repchar( $question->questiontext, $textformat )."{#\n";
         foreach ($question->options->answers as $answer) {
             if ($answer->answer != '') {
-                $expout .= "\t=".$answer->answer.":".(float)$answer->tolerance."#".$this->repchar( $answer->feedback )."\n";
+                $percentage = '';
+                if ($answer->fraction < 1) {
+                    $pval = $answer->fraction * 100;
+                    $percentage = "%$pval%";
+                }
+                $expout .= "\t=$percentage".$answer->answer.":".(float)$answer->tolerance."#".$this->repchar( $answer->feedback )."\n";
             } else {
                 $expout .= "\t~#".$this->repchar( $answer->feedback )."\n";
             }