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

foxr lon-capa-cvs-allow@mail.lon-capa.org
Wed, 24 Oct 2007 09:51:50 -0000


foxr		Wed Oct 24 05:51:50 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  BZ4074 - Completed testing of duplicate bubble handling.
         - Where unambiguous, bubble selector shows bubbles that were
           selected for multiline problems, and numeric or letter mode
           scantron.
         - For positional notiation, bubble_selector shows all bubbles
           that were marked.
  
  In all cases the set of bubbles that make up a single response are grouped in a single box.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.461 loncom/homework/grades.pm:1.462
--- loncom/homework/grades.pm:1.461	Wed Oct 17 06:48:20 2007
+++ loncom/homework/grades.pm	Wed Oct 24 05:51:47 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.461 2007/10/17 10:48:20 foxr Exp $
+# $Id: grades.pm,v 1.462 2007/10/24 09:51:47 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5383,20 +5383,22 @@
 
 		my $first_answer = $ansnum;
 		for (my $ans =0; $ans < $answers_needed; $ans++) {
-		    $record{"scantron.$ansnum.answer"} = '';
-		    $ans++;
+		    my $item = $first_answer+$ans;
+		    $record{"scantron.$item.answer"} = '';
 		}
 
 		my @ans=@array;
-		my $i=length($ans[0]);shift(@ans);
+		my $i=0;
+		my $increment = 0;
 		while ($#ans) {
-		    $i+=length($ans[0])+1;
-		    my $line   = $i/$$scantron_config{'Qlength'} + $first_answer;
+		    $i+=length($ans[0]) + $increment;
+		    my $line   = int($i/$$scantron_config{'Qlength'} + $first_answer);
 		    my $bubble = $i%$$scantron_config{'Qlength'};
-
 		    $record{"scantron.$line.answer"}.=$alphabet[$bubble];
 		    shift(@ans);
+		    $increment = 1;
 		}
+		$ansnum += $answers_needed;
 	    }
 	}
     }
@@ -6492,8 +6494,8 @@
 	if ($l != 0) {
 	    $r->print('<tr>');
 	}
+	my @selected = split(//,$lines[$l]);
 	for (my $i=0;$i<$max;$i++) {
-	    my @selected = split(//,$lines[$l]);
 	    $r->print("\n".'<td align="center">');
 	    if ($selected[0] eq $alphabet[$i]) { 
 		$r->print('X');