version 1.415, 2007/06/16 23:00:09
|
version 1.416, 2007/06/17 02:11:44
|
Line 6453 sub assign_clicker_grades {
|
Line 6453 sub assign_clicker_grades {
|
my ($r)=@_; |
my ($r)=@_; |
my ($symb)=&get_symb($r); |
my ($symb)=&get_symb($r); |
if (!$symb) {return '';} |
if (!$symb) {return '';} |
|
# See which part we are saving to |
|
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
|
# FIXME: This should probably look for the first handgradeable part |
|
my $part=$$partlist[0]; |
|
# Start screen output |
my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); |
my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); |
|
|
my $heading=&mt('Assigning grades based on clicker file'); |
my $heading=&mt('Assigning grades based on clicker file'); |
$result.=(<<ENDHEADER); |
$result.=(<<ENDHEADER); |
<br /><table width="100%" border="0"><tr><td bgcolor="#777777"> |
<br /><table width="100%" border="0"><tr><td bgcolor="#777777"> |
Line 6493 ENDHEADER
|
Line 6499 ENDHEADER
|
# Start grading |
# Start grading |
my $pcorrect=$env{'form.pcorrect'}; |
my $pcorrect=$env{'form.pcorrect'}; |
my $pincorrect=$env{'form.pincorrect'}; |
my $pincorrect=$env{'form.pincorrect'}; |
|
my $storecount=0; |
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
if ($key=~/^form\.student\:(.*)$/) { |
if ($key=~/^form\.student\:(.*)$/) { |
my $user=$1; |
my $user=$1; |
Line 6511 ENDHEADER
|
Line 6518 ENDHEADER
|
} |
} |
} |
} |
} |
} |
my $ave=$sum/$number; |
my $ave=$sum/(100*$number); |
$result.='<br />'.$user.' - '.$env{$key}.': '.$ave; |
# Store |
|
my ($username,$domain)=split(/\:/,$user); |
|
my %grades=(); |
|
$grades{"resource.$part.solved"}='correct_by_override'; |
|
$grades{"resource.$part.awarded"}=$ave; |
|
$grades{"resource.regrader"}="$env{'user.name'}:$env{'user.domain'}"; |
|
my $returncode=&Apache::lonnet::cstore(\%grades,$symb, |
|
$env{'request.course.id'}, |
|
$domain,$username); |
|
if ($returncode ne 'ok') { |
|
$result.="<br /><span class=\"LC_error\">Failed to save student $username:$domain. Message when trying to save was ($returncode)</span>"; |
|
} else { |
|
$storecount++; |
|
} |
} |
} |
} |
} |
# We are done |
# We are done |
$result.='</td></tr></table>'."\n". |
$result.='<br />'.&mt('Successfully stored grades for [_1] student(s).',$storecount). |
|
'</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); |
} |
} |