--- loncom/homework/grades.pm 2007/10/17 09:40:49 1.460 +++ loncom/homework/grades.pm 2007/10/17 10:48:20 1.461 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.460 2007/10/17 09:40:49 foxr Exp $ +# $Id: grades.pm,v 1.461 2007/10/17 10:48:20 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -91,7 +91,7 @@ sub get_response_bubbles { my $selected = ""; for (my $bline = 0; $bline < $bubble_lines; $bline++) { - $selected .= $$parsed_line{"scantron.$bubble_line.answer"}; + $selected .= $$parsed_line{"scantron.$bubble_line.answer"}.":"; $bubble_line++; } return $selected; @@ -5312,7 +5312,7 @@ sub scantron_parse_scanline { if ($bubble =~ /\d/) { $record{"scantron.$ansnum.answer"} = $alphabet[$bubble]; } else { - $record{"scantron.$ansnum.answer"}=''; + $record{"scantron.$ansnum.answer"}=' '; } $ansnum++; } @@ -6432,7 +6432,7 @@ ENDSCRIPT $r->print("

Please indicate which bubble should be used for grading

"); foreach my $question (@{$arg}) { my $selected = &get_response_bubbles($scan_record, $question); - my @select_array = split('',$selected); + my @select_array = split(/:/,$selected); &scantron_bubble_selector($r,$scan_config,$question, @select_array); } @@ -6465,17 +6465,18 @@ ENDSCRIPT $r - Apache request object $scan_config - hash from &get_scantron_config() $quest - number of the bubble line to make a corrector for - $selected - array of letters of previously selected bubbles + $lines - array of answer lines. =cut sub scantron_bubble_selector { - my ($r,$scan_config,$quest,@selected)=@_; + my ($r,$scan_config,$quest,@lines)=@_; my $max=$$scan_config{'Qlength'}; + my $scmode=$$scan_config{'Qon'}; - my $bubble_length = scalar(@selected); + my $bubble_length = scalar(@lines); if ($scmode eq 'number' || $scmode eq 'letter') { $max=10; } @@ -6491,8 +6492,8 @@ sub scantron_bubble_selector { if ($l != 0) { $r->print(''); } - for (my $i=0;$i<$max;$i++) { + my @selected = split(//,$lines[$l]); $r->print("\n".''); if ($selected[0] eq $alphabet[$i]) { $r->print('X');