--- loncom/homework/grades.pm 2007/11/13 01:47:36 1.489 +++ loncom/homework/grades.pm 2007/11/13 11:06:54 1.490 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.489 2007/11/13 01:47:36 albertel Exp $ +# $Id: grades.pm,v 1.490 2007/11/13 11:06:54 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -5406,10 +5406,9 @@ sub scantron_parse_scanline { my $answer_length = $$scantron_config{'Qlength'} * $answers_needed; - $questnum++; my $currentquest = substr($questions,0,$answer_length); - $questions = substr($questions,0,$answer_length)=''; + $questions = substr($questions,$answer_length); if (length($currentquest) < $answer_length) { next; } # Qon letter implies for each slot in currentquest we have: @@ -5419,7 +5418,6 @@ sub scantron_parse_scanline { if ($$scantron_config{'Qon'} eq 'letter') { - if ($currentquest =~ /\?/ || $currentquest =~ /\*/ || (&occurence_count($currentquest, "[A-Z]") > 1)) { @@ -5448,7 +5446,8 @@ sub scantron_parse_scanline { } } else { for (my $ans = 0; $ans < $answers_needed; $ans++) { - $record{"scantron.$ansnum.answer"} = substr($currentquest, $ans, 1); + my $bubble = substr($currentquest, $ans, 1); + $record{"scantron.$ansnum.answer"} = $bubble; $ansnum++; } } @@ -5515,10 +5514,9 @@ sub scantron_parse_scanline { push(@{$record{"scantron.missingerror"}},$questnum); } - # If the bubble is not the last position, there will be - # 2 elements. If it is the last position, there will be 1 element. - } elsif (scalar(@array) le 2) { + + } elsif (scalar(@array) eq 2) { my $location = length($array[0]); my $line_num = int($location / $$scantron_config{'Qlength'}); @@ -6951,9 +6949,10 @@ sub scantron_get_maxbubble { foreach my $part_id (@{$analysis{'parts'}}) { - my $lines = $analysis{"$part_id.bubble_lines"};; + + # TODO - make this a persistent hash not an array.