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

foxr lon-capa-cvs-allow@mail.lon-capa.org
Tue, 09 Oct 2007 10:31:22 -0000


foxr		Tue Oct  9 06:31:22 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  BZ 4074 - still not quite working but closer. Got double bubbles
  to display the right number of bubble lines, but not the marks
  :-(
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.447 loncom/homework/grades.pm:1.448
--- loncom/homework/grades.pm:1.447	Tue Oct  9 05:16:04 2007
+++ loncom/homework/grades.pm	Tue Oct  9 06:31:21 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.447 2007/10/09 09:16:04 foxr Exp $
+# $Id: grades.pm,v 1.448 2007/10/09 10:31:21 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -56,8 +56,9 @@
 
 
 sub save_bubble_lines {
-
+    &Apache::lonnet::logthis("Saving bubble_lines...");
     foreach my $line (keys(%bubble_lines_per_response)) {
+	&Apache::lonnet::logthis("Saving form.scantron.bubblelines.$line value: $bubble_lines_per_response{$line}");
 	$env{"form.scantron.bubblelines.$line"}  = $bubble_lines_per_response{$line};
 	$env{"form.scantron.first_bubble_line.$line"} =
 	    $first_bubble_line{$line};
@@ -70,6 +71,7 @@
     %bubble_lines_per_response = ();
     while ($env{"form.scantron.bubblelines.$line"}) {
 	my $value = $env{"form.scantron.bubblelines.$line"};
+	&Apache::lonnet::logthis("Restoring form.scantron.bubblelines.$line value: $value");
 	$bubble_lines_per_response{$line} = $value;
 	$first_bubble_line{$line}  =
 	    $env{"form.scantron.first_bubble_line.$line"};
@@ -85,7 +87,7 @@
     my ($parsed_line, $response)  = @_;
 
     my $bubble_line = $first_bubble_line{$response};
-    my $bubble_lines= $bubble_linse_per_response{$response};
+    my $bubble_lines= $bubble_lines_per_response{$response};
     my $selected = "";
 
     for (my $bline = 0; $bline < $bubble_lines; $bline++) {
@@ -5714,10 +5716,11 @@
 
   my $line = 0;
     while (defined($env{"form.scantron.bubblelines.$line"})) {
+	&Apache::lonnet::logthis("Saving chunk for $line");
        my $chunk =
 	   '<input type="hidden" name="scantron.bubblelines.'.$line.'" value="'.$env{"form.scantron.bubblelines.$line"}.'" />'."\n";
-       $chunk +=
-	   '<input type="hidden" name="scantron.first_bubble_line.'.$line'." value="'.$env{"form.scantron.first_bubble_line.$line"}.'" />'."\n";
+       $chunk .=
+	   '<input type="hidden" name="scantron.first_bubble_line.'.$line.'" value="'.$env{"form.scantron.first_bubble_line.$line"}.'" />'."\n";
        $result .= $chunk;
        $line++;
    }
@@ -5779,6 +5782,8 @@
     }
     my $currentphase=$env{'form.validatepass'};
 
+    &Apache::lonnet::logthis("Phase: $currentphase");
+
     my $stop=0;
     while (!$stop && $currentphase < scalar(@validate_phases)) {
 	$r->print("<p> Validating ".$validate_phases[$currentphase]."</p>");
@@ -6401,7 +6406,7 @@
 	$r->print('<input type="hidden" name="scantron_questions" value="'.
 		  join(',',@{$arg}).'" />');
 	foreach my $question (@{$arg}) {
-	    my $selected = &get_response_bubbles($scan_record, $quesion);
+	    my $selected = &get_response_bubbles($scan_record, $question);
 	    &scantron_bubble_selector($r,$scan_config,$question);
 	}
     } else {
@@ -6435,8 +6440,9 @@
 
     if ($scmode eq 'number' || $scmode eq 'letter') { $max=10; }	     
 
-
-    my $lines = $bubble_lines_per_response{$quest};
+    my $response = $quest-1;
+    my $lines = $bubble_lines_per_response{$response};
+    &Apache::lonnet::logthis("Question $quest, lines: $lines");
 
     my $total_lines = $lines*2;
     my @alphabet=('A'..'Z');
@@ -6700,12 +6706,14 @@
 =cut
 
 sub scantron_get_maxbubble {    
-
+    &Apache::lonnet::logthis("get_max_bubble");
     if (defined($env{'form.scantron_maxbubble'}) &&
 	$env{'form.scantron_maxbubble'}) {
+	&Apache::lonnet::logthis("cached");
 	&restore_bubble_lines();
 	return $env{'form.scantron_maxbubble'};
     }
+    &Apache::lonnet::logthis("computing");
 
     my (undef, undef, $sequence) =
 	&Apache::lonnet::decode_symb($env{'form.selectpage'});