--- loncom/homework/grades.pm 2005/06/03 18:23:19 1.269 +++ loncom/homework/grades.pm 2005/06/05 06:12:16 1.274 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.269 2005/06/03 18:23:19 raeburn Exp $ +# $Id: grades.pm,v 1.274 2005/06/05 06:12:16 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1352,15 +1352,14 @@ sub gradeBox { my $result=''."\n"; my $display_part=&get_display_part($partid,undef,$symb); - my @partids = ("$partid"); - my %last_resets = (); - &get_last_resets($symb,$env{'request.course.id'},\%last_resets,\@partids); - my $aggtries; + + my %last_resets = &get_last_resets($symb,$env{'request.course.id'}, + [$partid]); + my $aggtries = $$record{'resource.'.$partid.'.tries'}; if ($last_resets{$partid}) { $aggtries = &get_num_tries($record,$last_resets{$partid},$partid); - } else { - $aggtries = $$record{'resource.'.$partid.'.tries'}; } + $result.='
'. 'Part: '.$display_part.' Points: | '."\n"; @@ -2156,17 +2155,17 @@ sub saveHandGrade { } $newrecord{'resource.'.$new_part.'.regrader'}= "$env{'user.name'}:$env{'user.domain'}"; - my @partids = ("$new_part"); - my %last_resets = (); - &get_last_resets($symb,$env{'request.course.id'},\%last_resets,\@partids); - my ($totaltries,$aggtries,$solvedstatus); - $totaltries = $record{'resource.'.$part.'.tries'}; + my $totaltries = $record{'resource.'.$part.'.tries'}; + + my %last_resets = &get_last_resets($symb,$env{'request.course.id'}, + [$new_part]); + my $aggtries =$totaltries; if ($last_resets{$new_part}) { - $aggtries = &get_num_tries(\%record,$last_resets{$new_part},$new_part); - } else { - $aggtries = $totaltries; + $aggtries = &get_num_tries(\%record,$last_resets{$new_part}, + $new_part); } - $solvedstatus = $record{'resource.'.$new_part.'.solved'}; + + my $solvedstatus = $record{'resource.'.$new_part.'.solved'}; if ($aggtries > 0) { &decrement($symb,$new_part,\%aggregate,$aggtries,$totaltries,$solvedstatus); $aggregateflag = 1; @@ -2270,22 +2269,20 @@ sub decrement_aggs { # ----------- Determine timestamps for last reset of aggregate totals for parts sub get_last_resets { - my ($symb,$courseid,$last_resets,$partids) =@_; + my ($symb,$courseid,$partids) =@_; + my %last_resets; my $cdom = $env{'course.'.$courseid.'.domain'}; my $cname = $env{'course.'.$courseid.'.num'}; - my %resethash = &Apache::lonnet::restore($symb,'nohist_resourcetracker',$cdom,$cname); - if ($resethash{'version'}) { - foreach my $part (@{$partids}) { - $$last_resets{$part} = ''; - for (my $version=$resethash{'version'};$version>=1;$version--) { - if (exists($resethash{$version.':'.$part."\0".'prev_attempts'})) { - $$last_resets{$part} = $resethash{$version.':timestamp'}; - last; - } - } - } + my @keys; + foreach my $part (@{$partids}) { + push(@keys,"$symb\0$part\0resettime"); + } + my %results=&Apache::lonnet::get('nohist_resourcetracker',\@keys, + $cdom,$cname); + foreach my $part (@{$partids}) { + $last_resets{$part}=$results{"$symb\0$part\0resettime"}; } - return; + return %last_resets; } # ----------- Handles creating versions for portfolio files as answers @@ -2630,9 +2627,8 @@ sub viewgrades { } $result.=' | ';
my ($aggtries,$totaltries);
unless (exists($aggregates{$part})) {
- $totaltries = $record{'resource.'.$part.'.tries'};
+ $totaltries = $record{'resource.'.$part.'.tries'};
+
+ $aggtries = $totaltries;
if ($$last_resets{$part}) {
- $aggtries = &get_num_tries(\%record,$$last_resets{$part},$part);
- } else {
- $aggtries = $totaltries;
- }
+ $aggtries = &get_num_tries(\%record,$$last_resets{$part},
+ $part);
+ }
$result.=''."\n";
$result.=' Yes
+
| |||||
Options: |
- Do only previously skipped records - Remove all exisiting corrections + + |
||||||
$quest | "); for (my $i=0;$i<$max+1;$i++) { - $r->print(''); + $r->print("\n".' | '); if ($selected[0] eq $alphabet[$i]) { $r->print('X'); shift(@selected) } else { $r->print(' '); } $r->print(' | '); } - $r->print('|
'.$alphabet[$i]." | "); + $r->print("\n". + '"); } - $r->print(' | No bubble | '); + $r->print(''); $r->print(' |