[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 17 Oct 2006 20:19:32 -0000
albertel Tue Oct 17 16:19:32 2006 EDT
Modified files:
/loncom/homework grades.pm
Log:
- grading fro a set wasn't removing grading queue items
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.379 loncom/homework/grades.pm:1.380
--- loncom/homework/grades.pm:1.379 Fri Oct 13 17:53:34 2006
+++ loncom/homework/grades.pm Tue Oct 17 16:19:31 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.379 2006/10/13 21:53:34 albertel Exp $
+# $Id: grades.pm,v 1.380 2006/10/17 20:19:31 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2420,17 +2420,8 @@
}
&Apache::lonnet::cstore(\%newrecord,$symb,
$env{'request.course.id'},$domain,$stuname);
- my @ungraded_parts;
- foreach my $part (@parts) {
- if ( !defined($record{'resource.'.$part.'.awarded'})
- && !defined($newrecord{'resource.'.$part.'.awarded'}) ) {
- push(@ungraded_parts, $part);
- }
- }
- if ( !@ungraded_parts ) {
- &Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom,
- $cnum,$domain,$stuname);
- }
+ &check_and_remove_from_queue(\@parts,\%record,\%newrecord,$symb,
+ $cdom,$cnum,$domain,$stuname);
}
if ($aggregateflag) {
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
@@ -2439,6 +2430,24 @@
return ('',$pts,$wgt);
}
+sub check_and_remove_from_queue {
+ my ($parts,$record,$newrecord,$symb,$cdom,$cnum,$domain,$stuname) = @_;
+ my @ungraded_parts;
+ foreach my $part (@{$parts}) {
+ if ( $record->{ 'resource.'.$part.'.awarded'} eq ''
+ && $record->{ 'resource.'.$part.'.solved' } ne 'excused'
+ && $newrecord->{'resource.'.$part.'.awarded'} eq ''
+ && $newrecord->{'resource.'.$part.'.solved' } ne 'excused'
+ ) {
+ push(@ungraded_parts, $part);
+ }
+ }
+ if ( !@ungraded_parts ) {
+ &Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom,
+ $cnum,$domain,$stuname);
+ }
+}
+
sub handback_files {
my ($request,$symb,$stuname,$domain,$newflg,$new_part,$newrecord) = @_;
my $portfolio_root = &propath($domain,$stuname).'/userfiles/portfolio';
@@ -4180,9 +4189,8 @@
$displayPts[1].=' <b>Part:</b> '.$display_part.' = '.
(($score eq 'excused') ? 'excused' : $newpts).
' <br />';
-
$question++;
- next if ($dropMenu eq 'reset status' || ($newpts == $oldpts && $score ne 'excused'));
+ next if ($dropMenu eq 'reset status' || ($newpts eq $oldpts && $score ne 'excused'));
$newrecord{'resource.'.$partid.'.awarded'} = $partial if $partial ne '';
$newrecord{'resource.'.$partid.'.solved'} = $score if $score ne '';
@@ -4194,7 +4202,12 @@
if (scalar(keys(%newrecord)) > 0) {
&Apache::lonnet::cstore(\%newrecord,$symbx,$env{'request.course.id'},
$udom,$uname);
+ my %record = &Apache::lonnet::restore($symbx,$env{'request.course.id'},
+ $udom,$uname);
+ &check_and_remove_from_queue($parts,\%record,undef,$symbx,
+ $cdom,$cnum,$udom,$uname);
}
+
if ($aggregateflag) {
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
$env{'course.'.$env{'request.course.id'}.'.domain'},