[LON-CAPA-cvs] cvs: loncom /homework grades.pm
banghart
lon-capa-cvs-allow@mail.lon-capa.org
Tue, 09 Oct 2007 23:03:23 -0000
banghart Tue Oct 9 19:03:23 2007 EDT
Modified files:
/loncom/homework grades.pm
Log:
Saving work in progress. Getting close. Need to handle multiple
groups and "none".
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.449 loncom/homework/grades.pm:1.450
--- loncom/homework/grades.pm:1.449 Tue Oct 9 15:33:56 2007
+++ loncom/homework/grades.pm Tue Oct 9 19:03:22 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.449 2007/10/09 19:33:56 banghart Exp $
+# $Id: grades.pm,v 1.450 2007/10/09 23:03:22 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -477,6 +477,7 @@
sub getclasslist {
my ($getsec,$filterlist,$getgroup) = @_;
my @getsec;
+ my @getgroup;
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
if (!ref($getsec)) {
if ($getsec ne '' && $getsec ne 'all') {
@@ -486,6 +487,14 @@
@getsec=@{$getsec};
}
if (grep(/^all$/,@getsec)) { undef(@getsec); }
+ if (!ref($getgroup)) {
+ if ($getgroup ne '' && $getgroup ne 'all') {
+ @getgroup=($getgroup);
+ }
+ } else {
+ @getgroup=@{$getgroup};
+ }
+ if (grep(/^all$/,@getgroup)) { undef(@getgroup); }
my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();
# Bail out if we were unable to get the classlist
@@ -512,15 +521,29 @@
# filter students according to status selected
if ($filterlist && (!($stu_status =~ /Any/))) {
if (!($stu_status =~ $status)) {
- delete ($classlist->{$student});
+ delete($classlist->{$student});
next;
}
}
+ # filter students according to groups selected
+ if (@getgroup) {
+ my $exclude = 1;
+ foreach my $grp(@getgroup) {
+ if ($group eq $grp) {
+ $exclude = 0;
+ }
+ }
+ if ($exclude) {
+ delete($classlist->{$student});
+ }
+ }
$section = ($section ne '' ? $section : 'none');
if (&canview($section)) {
if (!@getsec || grep(/^\Q$section\E$/,@getsec)) {
$sections{$section}++;
- $fullnames{$student}=$fullname;
+ if ($classlist->{$student}) {
+ $fullnames{$student}=$fullname;
+ }
} else {
delete($classlist->{$student});
}
@@ -872,7 +895,7 @@
'value="Next->" /> <br />'."\n";
$gradeTable.=&check_buttons();
$gradeTable.='<label><input type="checkbox" name="checkPlag" checked="checked" />Check For Plagiarism</label>';
- my ($classlist, undef, $fullname) = &getclasslist($getsec,'1');
+ my ($classlist, undef, $fullname) = &getclasslist($getsec,'1',$getgroup);
$gradeTable.='<table border="0"><tr><td bgcolor="#777777">'.
'<table border="0"><tr bgcolor="#e6ffff">';
my $loop = 0;