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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 16 Nov 2007 08:52:18 -0000


albertel		Fri Nov 16 03:52:18 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - the question line can be longer (sometimes much longer) than the number of actually valid questions, default to an answer length of 1 for these nonexistant questions
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.493 loncom/homework/grades.pm:1.494
--- loncom/homework/grades.pm:1.493	Fri Nov 16 03:50:39 2007
+++ loncom/homework/grades.pm	Fri Nov 16 03:52:15 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.493 2007/11/16 08:50:39 albertel Exp $
+# $Id: grades.pm,v 1.494 2007/11/16 08:52:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5403,8 +5403,8 @@
     $questions =~ s/\r$//;      # Get rid of trailing \r too (MAC or Win uploads).
     while (length($questions)) {
 	my $answers_needed = $bubble_lines_per_response{$questnum};
-	my $answer_length  = $$scantron_config{'Qlength'} * $answers_needed;
-
+	my $answer_length  = ($$scantron_config{'Qlength'} * $answers_needed)
+	                     || 1;
 
 	$questnum++;
 	my $currentquest = substr($questions,0,$answer_length);