MDL-10819:

GIFT now exports grade fractions for numeric questions

Merged from STABLE_18
This commit is contained in:
thepurpleblob 2007-08-20 10:36:30 +00:00
parent c1828e0b19
commit 13e88db4a2

View File

@ -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";
}