[LON-CAPA-cvs] cvs: loncom /homework grades.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 18 Feb 2005 23:36:16 -0000


albertel		Fri Feb 18 18:36:16 2005 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - BUG#3896 & 3895, mishandling the ungraded and incorrect situations
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.247 loncom/homework/grades.pm:1.248
--- loncom/homework/grades.pm:1.247	Thu Feb 17 03:58:16 2005
+++ loncom/homework/grades.pm	Fri Feb 18 18:36:12 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.247 2005/02/17 08:58:16 albertel Exp $
+# $Id: grades.pm,v 1.248 2005/02/18 23:36:12 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -695,10 +695,12 @@
 	    (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
 	    my $submitted = 0;
 	    my $graded = 0;
+	    my $incorrect = 0;
 	    foreach (keys(%status)) {
 		$submitted = 1 if ($status{$_} ne 'nothing');
-		$graded = 1 if ($status{$_} !~ /^correct/);
-
+		$graded = 1 if ($status{$_} =~ /^ungraded/);
+		$incorrect = 1 if ($status{$_} =~ /^incorrect/);
+		
 		my ($foo,$partid,$foo1) = split(/\./,$_);
 		if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
 		    $submitted = 0;
@@ -708,11 +710,12 @@
 			$status{'resource.'.$partid.'.submitted_by'}.'" />';
 		}
 	    }
+	    
 	    next if (!$submitted && ($submitonly eq 'yes' ||
 				     $submitonly eq 'incorrect' ||
 				     $submitonly eq 'graded'));
-	    next if (!$graded && ($submitonly eq 'graded' ||
-				  $submitonly eq 'incorrect'));
+	    next if (!$graded && ($submitonly eq 'graded'));
+	    next if (!$incorrect && $submitonly eq 'incorrect');
 	}
 
 	$ctr++;
@@ -720,7 +723,7 @@
 	    $gradeTable.='<tr bgcolor="#ffffe6">' if ($ctr%2 ==1);
 	    $gradeTable.='<td align="right">'.$ctr.'&nbsp;</td>'.
 		'<td align="center"><input type=checkbox name="stuinfo" value="'.
-		$student.':'.$$fullname{$student}.'&nbsp;"></td>'."\n".
+		$student.':'.$$fullname{$student}.'&nbsp;" /></td>'."\n".
 		'<td>'.&nameUserString(undef,$$fullname{$student},$uname,$udom).'</td>'."\n";
 
 	    if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
@@ -2006,10 +2009,12 @@
 #	    my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
 	    my %status=&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
 	    my $submitted = 0;
-	    my $graded = 1;
+	    my $ungraded = 0;
+	    my $incorrect = 0;
 	    foreach (keys(%status)) {
 		$submitted = 1 if ($status{$_} ne 'nothing');
-		$graded = 0 if ($status{$_} =~ /^correct/);
+		$ungraded = 1 if ($status{$_} =~ /^ungraded/);
+		$incorrect = 1 if ($status{$_} =~ /^incorrect/);
 		my ($foo,$partid,$foo1) = split(/\./,$_);
 		if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
 		    $submitted = 0;
@@ -2018,8 +2023,8 @@
 	    next if (!$submitted && ($submitonly eq 'yes' ||
 				     $submitonly eq 'incorrect' ||
 				     $submitonly eq 'graded'));
-	    next if (!$graded && ($submitonly eq 'graded' ||
-				  $submitonly eq 'incorrect'));
+	    next if (!$ungraded && ($submitonly eq 'graded'));
+	    next if (!$incorrect && $submitonly eq 'incorrect');
 	}
 	push @nextlist,$student if ($ctr < $ntstu);
 	last if ($ctr == $ntstu);