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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 04 Feb 2008 13:46:40 -0000


raeburn		Mon Feb  4 08:46:40 2008 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Bug 5589.  Suppress prompts for missingbubbles caused by trailing spaces after end of bubble data in each scanline.
  -  As more than one line is possible for each question, need to compare last bubble for question number of "missingbubble" with max_bubble for the scanline.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.504 loncom/homework/grades.pm:1.505
--- loncom/homework/grades.pm:1.504	Fri Feb  1 21:28:02 2008
+++ loncom/homework/grades.pm	Mon Feb  4 08:46:35 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.504 2008/02/02 02:28:02 raeburn Exp $
+# $Id: grades.pm,v 1.505 2008/02/04 13:46:35 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7262,7 +7262,25 @@
 	# Probably here's where the error is...
 
 	foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) {
-	    if ($missing > $max_bubble) { next; }
+            my $lastbubble;
+            if ($missing =~ /^(\d+)\.(\d+)$/) {
+               my $question = $1;
+               my $subquestion = $2;
+               if (!defined($first_bubble_line{$question -1})) { next; }
+               my $first = $first_bubble_line{$question-1};
+               my @subans = split(/,/,$subdivided_bubble_lines{$question-1});
+               my $subcount = 1;
+               while ($subcount<$subquestion) {
+                   $first += $subans[$subcount-1];
+                   $subcount ++;
+               }
+               my $count = $subans[$subquestion-1];
+               $lastbubble = $first + $count;
+            } else {
+                if (!defined($first_bubble_line{$missing - 1})) { next; }
+                $lastbubble = $first_bubble_line{$missing - 1} + $bubble_lines_per_response{$missing - 1};
+            }
+            if ($lastbubble > $max_bubble) { next; }
 	    push(@to_correct,$missing);
 	}
 	if (@to_correct) {