[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 02 Dec 2005 19:56:36 -0000
This is a MIME encoded message
--albertel1133553396
Content-Type: text/plain
albertel Fri Dec 2 14:56:36 2005 EDT
Modified files:
/loncom/homework grades.pm
Log:
- remove graded users from grading queue
- &remove_from_queue() only does so now if user is &in_queue()
--albertel1133553396
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20051202145636.txt"
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.300 loncom/homework/grades.pm:1.301
--- loncom/homework/grades.pm:1.300 Fri Dec 2 14:40:47 2005
+++ loncom/homework/grades.pm Fri Dec 2 14:56:36 2005
@@ -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 @@
while ($loop < 2) {
$gradeTable.='<td><b> No.</b> </td><td><b> Select </b></td>'.
'<td>'.&nameUserString('header').' Section/Group</td>';
- 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.='<td><b> Part: '.$display_part.
' Status </b></td>';
}
+ } elsif ($submitonly eq 'queued') {
+ $gradeTable.='<td><b> '.&mt('Queue Status').' </b></td>';
}
$loop++;
# $gradeTable.='<td></td>' if ($loop%2 ==1);
@@ -726,8 +730,20 @@
}
(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 @@
}
if ($ctr%2 ==1) {
$gradeTable.='<td> </td><td> </td><td> </td>';
- if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ if ($env{'form.showgrading'} eq 'yes'
+ && $submitonly ne 'queued'
+ && $submitonly ne 'all') {
foreach (@$partlist) {
$gradeTable.='<td> </td>';
}
+ } elsif ($submitonly eq 'queued') {
+ $gradeTable.='<td> </td>';
}
$gradeTable.='</tr>';
}
@@ -798,6 +818,7 @@
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='<br /> <font color="red">'.
'No '.$submissions.' found for this resource for any students. ('.$num_students.
' students checked for '.$submissions.')</font><br />';
@@ -1960,6 +1981,9 @@
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 @@
$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 @@
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 @@
my $the_end = '<h3><font color="red">LON-CAPA User Message</font></h3><br />'."\n";
$the_end.='<b>Message: </b> No more students for this section or class.<br /><br />'."\n";
$the_end.='Click on the button below to return to the grading menu.<br /><br />'."\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 @@
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 @@
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 @@
}
}
$line.='</tr>'."\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.='<tr bgcolor="#ffffde"><td align="right"> '.$updateCtr.' </td>'.$line;
$updateCtr++;
} else {
@@ -2934,8 +3008,7 @@
}
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 @@
($saveCmd eq 'submission' ? 'checked' : '').'> '.'<b>'.&mt('Current Resource').':</b> '.&mt('For one or more students').
'</label> <select name="submitonly">'.
'<option value="yes" '.
- ($saveSub eq 'yes' ? 'selected="on"' : '').'>with submissions</option>'.
+ ($saveSub eq 'yes' ? 'selected="on"' : '').'>'.&mt('with submissions').'</option>'.
+ '<option value="queued" '.
+ ($saveSub eq 'queued' ? 'selected="on"' : '').'>'.&mt('in grading queue').'</option>'.
'<option value="graded" '.
- ($saveSub eq 'graded' ? 'selected="on"' : '').'>with ungraded submissions</option>'.
+ ($saveSub eq 'graded' ? 'selected="on"' : '').'>'.&mt('with ungraded submissions').'</option>'.
'<option value="incorrect" '.
- ($saveSub eq 'incorrect' ? 'selected="on"' : '').'>with incorrect submissions</option>'.
+ ($saveSub eq 'incorrect' ? 'selected="on"' : '').'>'.&mt('with incorrect submissions').'</option>'.
'<option value="all" '.
- ($saveSub eq 'all' ? 'selected="on"' : '').'>with any status</option></select></td></tr>'."\n";
+ ($saveSub eq 'all' ? 'selected="on"' : '').'>'.&mt('with any status').'</option></select></td></tr>'."\n";
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'.
'<label><input type="radio" name="radioChoice" value="viewgrades" '.
--albertel1133553396--