--- loncom/homework/grades.pm 2005/12/02 19:40:47 1.300
+++ loncom/homework/grades.pm 2005/12/02 19:56:36 1.301
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.300 2005/12/02 19:40:47 albertel Exp $
+# $Id: grades.pm,v 1.301 2005/12/02 19:56:36 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -704,12 +704,16 @@ LISTJAVASCRIPT
while ($loop < 2) {
$gradeTable.='
No. | Select | '.
''.&nameUserString('header').' Section/Group | ';
- if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ if ($env{'form.showgrading'} eq 'yes'
+ && $submitonly ne 'queued'
+ && $submitonly ne 'all') {
foreach (sort(@$partlist)) {
my $display_part=&get_display_part((split(/_/))[0],$url,$symb);
$gradeTable.=' Part: '.$display_part.
' Status | ';
}
+ } elsif ($submitonly eq 'queued') {
+ $gradeTable.=' '.&mt('Queue Status').' | ';
}
$loop++;
# $gradeTable.=' | ' if ($loop%2 ==1);
@@ -726,8 +730,20 @@ LISTJAVASCRIPT
}
(keys(%$fullname))) {
my ($uname,$udom) = split(/:/,$student);
+
my %status = ();
- if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+
+ if ($submitonly eq 'queued') {
+ my %queue_status =
+ &Apache::bridgetask::get_student_status($symb,$cdom,$cnum,
+ $udom,$uname);
+ next if (!defined($queue_status{'gradingqueue'}));
+ $status{'gradingqueue'} = $queue_status{'gradingqueue'};
+ }
+
+ if ($env{'form.showgrading'} eq 'yes'
+ && $submitonly ne 'queued'
+ && $submitonly ne 'all') {
(%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
my $submitted = 0;
my $graded = 0;
@@ -778,10 +794,14 @@ LISTJAVASCRIPT
}
if ($ctr%2 ==1) {
$gradeTable.=' | | | ';
- if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ if ($env{'form.showgrading'} eq 'yes'
+ && $submitonly ne 'queued'
+ && $submitonly ne 'all') {
foreach (@$partlist) {
$gradeTable.=' | ';
}
+ } elsif ($submitonly eq 'queued') {
+ $gradeTable.=' | ';
}
$gradeTable.='';
}
@@ -798,6 +818,7 @@ LISTJAVASCRIPT
my $submissions='submissions';
if ($submitonly eq 'incorrect') { $submissions = 'incorrect submissions'; }
if ($submitonly eq 'graded' ) { $submissions = 'ungraded submissions'; }
+ if ($submitonly eq 'queued' ) { $submissions = 'queued submissions'; }
$gradeTable='
'.
'No '.$submissions.' found for this resource for any students. ('.$num_students.
' students checked for '.$submissions.')
';
@@ -1960,6 +1981,9 @@ sub processHandGrade {
my $button = $env{'form.gradeOpt'};
my $ngrade = $env{'form.NCT'};
my $ntstu = $env{'form.NTSTU'};
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+
if ($button eq 'Save & Next') {
my $ctr = 0;
while ($ctr < $ngrade) {
@@ -2057,9 +2081,7 @@ sub processHandGrade {
$env{'form.savemsgN'} = --$idx;
$keyhash{$symb.'_savemsgN'} = $env{'form.savemsgN'};
my $putresult = &Apache::lonnet::put
- ('nohist_handgrade',\%keyhash,
- $env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'});
+ ('nohist_handgrade',\%keyhash,$cdom,$cnum);
}
# Called by Save & Refresh from Highlight Attribute Window
my (undef,undef,$fullname) = &getclasslist($env{'form.section'},'1');
@@ -2125,6 +2147,14 @@ sub processHandGrade {
foreach my $student (@parsedlist) {
my $submitonly=$env{'form.submitonly'};
my ($uname,$udom) = split(/:/,$student);
+
+ if ($submitonly eq 'queued') {
+ my %queue_status =
+ &Apache::bridgetask::get_student_status($symb,$cdom,$cnum,
+ $udom,$uname);
+ next if (!defined($queue_status{'gradingqueue'}));
+ }
+
if ($submitonly =~ /^(yes|graded|incorrect)$/) {
# my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$udom,$uname);
my %status=&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
@@ -2166,7 +2196,7 @@ sub processHandGrade {
my $the_end = 'LON-CAPA User Message
'."\n";
$the_end.='Message: No more students for this section or class.
'."\n";
$the_end.='Click on the button below to return to the grading menu.
'."\n";
- $the_end.=&show_grading_menu_form ($symb,$url);
+ $the_end.=&show_grading_menu_form($symb,$url);
$request->print($the_end);
}
return '';
@@ -2185,7 +2215,9 @@ sub saveHandGrade {
my ($pts,$wgt) = ('','');
my %aggregate = ();
my $aggregateflag = 0;
- foreach my $new_part (split(/:/,$env{'form.partlist'.$newflg})) {
+
+ my @parts = split(/:/,$env{'form.partlist'.$newflg});
+ foreach my $new_part (@parts) {
#collaborator may vary for different parts
if ($submitter && $new_part ne $part) { next; }
my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part};
@@ -2260,19 +2292,33 @@ sub saveHandGrade {
push (@v_flag,$new_part);
}
}
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+
if (scalar(keys(%newrecord)) > 0) {
if (scalar(@v_flag)) {
&version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname, \@v_flag);
}
&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);
+ }
}
if ($aggregateflag) {
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
- $env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'});
+ $cdom,$cnum);
}
- return '',$pts,$wgt;
+ return ('',$pts,$wgt);
}
# ----------- Provides number of tries since last reset.
@@ -2922,10 +2968,38 @@ sub editgrades {
}
}
$line.=''."\n";
+
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+
if ($updateflag) {
$count++;
&Apache::lonnet::cstore(\%newrecord,$symb,$env{'request.course.id'},
$udom,$uname);
+
+ if (&Apache::bridgetask::in_queue('gradingqueue',$symb,$cdom,
+ $cnum,$udom,$uname)) {
+ # need to figure out if should be in queue.
+ my %record =
+ &Apache::lonnet::restore($symb,$env{'request.course.id'},
+ $udom,$uname);
+ my $all_graded = 1;
+ my $none_graded = 1;
+ foreach my $part (@parts) {
+ if ( $record{'resource.'.$part.'.awarded'} eq '' ) {
+ $all_graded = 0;
+ } else {
+ $none_graded = 0;
+ }
+ }
+
+ if ($all_graded || $none_graded) {
+ &Apache::bridgetask::remove_from_queue('gradingqueue',
+ $symb,$cdom,$cnum,
+ $udom,$uname);
+ }
+ }
+
$result.=' '.$updateCtr.' | '.$line;
$updateCtr++;
} else {
@@ -2934,8 +3008,7 @@ sub editgrades {
}
if ($aggregateflag) {
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
- $env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'});
+ $cdom,$cnum);
}
}
if ($noupdate) {
@@ -5466,13 +5539,15 @@ GRADINGMENUJS
($saveCmd eq 'submission' ? 'checked' : '').'> '.''.&mt('Current Resource').': '.&mt('For one or more students').
'
'."\n";
+ ($saveSub eq 'all' ? 'selected="on"' : '').'>'.&mt('with any status').''."\n";
$result.=''.
' |