version 1.414, 2007/06/16 20:24:25
|
version 1.415, 2007/06/16 23:00:09
|
Line 6463 ENDHEADER
|
Line 6463 ENDHEADER
|
# Get correct result |
# Get correct result |
# FIXME: Possibly need delimiter other than ":" |
# FIXME: Possibly need delimiter other than ":" |
my @correct=(); |
my @correct=(); |
if ($env{'form.gradingmechanism'} ne 'attendance') { |
my $gradingmechanism=$env{'form.gradingmechanism'}; |
|
my $number=$env{'form.number'}; |
|
if ($gradingmechanism ne 'attendance') { |
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
if ($key=~/^form\.correct\:/) { |
if ($key=~/^form\.correct\:/) { |
my @input=split(/\,/,$env{$key}); |
my @input=split(/\,/,$env{$key}); |
Line 6479 ENDHEADER
|
Line 6481 ENDHEADER
|
} |
} |
} |
} |
} |
} |
for (my $i=0;$i<$env{'form.number'};$i++) { |
for (my $i=0;$i<$number;$i++) { |
if (!$correct[$i]) { |
if (!$correct[$i]) { |
$result.='<br /><span class="LC_error">'. |
$result.='<br /><span class="LC_error">'. |
&mt('No correct result given for question "[_1]"!', |
&mt('No correct result given for question "[_1]"!', |
Line 6489 ENDHEADER
|
Line 6491 ENDHEADER
|
$result.='<br />'.&mt("Correct answer: [_1]",join(', ',map { ($_?$_:'-') } @correct)); |
$result.='<br />'.&mt("Correct answer: [_1]",join(', ',map { ($_?$_:'-') } @correct)); |
} |
} |
# Start grading |
# Start grading |
|
my $pcorrect=$env{'form.pcorrect'}; |
|
my $pincorrect=$env{'form.pincorrect'}; |
|
foreach my $key (keys(%env)) { |
|
if ($key=~/^form\.student\:(.*)$/) { |
|
my $user=$1; |
|
my @answer=split(/\,/,$env{$key}); |
|
my $sum=0; |
|
for (my $i=0;$i<$number;$i++) { |
|
if ($answer[$i]) { |
|
if ($gradingmechanism eq 'attendance') { |
|
$sum+=$pcorrect; |
|
} else { |
|
if ($answer[$i] eq $correct[$i]) { |
|
$sum+=$pcorrect; |
|
} else { |
|
$sum+=$pincorrect; |
|
} |
|
} |
|
} |
|
} |
|
my $ave=$sum/$number; |
|
$result.='<br />'.$user.' - '.$env{$key}.': '.$ave; |
|
} |
|
} |
|
# We are done |
$result.='</td></tr></table>'."\n". |
$result.='</td></tr></table>'."\n". |
'</td></tr></table><br /><br />'."\n"; |
'</td></tr></table><br /><br />'."\n"; |
return $result.&show_grading_menu_form($symb); |
return $result.&show_grading_menu_form($symb); |