version 1.469, 2007/10/26 20:18:43
|
version 1.470, 2007/10/29 09:46:28
|
Line 5239 sub scan_data {
|
Line 5239 sub scan_data {
|
|
|
sub scantron_parse_scanline { |
sub scantron_parse_scanline { |
my ($line,$whichline,$scantron_config,$scan_data,$just_header)=@_; |
my ($line,$whichline,$scantron_config,$scan_data,$just_header)=@_; |
|
|
my %record; |
my %record; |
my $questions=substr($line,$$scantron_config{'Qstart'}-1); # Answers |
my $questions=substr($line,$$scantron_config{'Qstart'}-1); # Answers |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); # earlier stuff |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); # earlier stuff |
Line 5277 sub scantron_parse_scanline {
|
Line 5278 sub scantron_parse_scanline {
|
my $questnum=0; |
my $questnum=0; |
my $ansnum =1; # Multiple 'answer lines'/question. |
my $ansnum =1; # Multiple 'answer lines'/question. |
|
|
while ($questions) { |
chomp($questions); # Get rid of any trailing \n. |
|
$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 $answers_needed = $bubble_lines_per_response{$questnum}; |
my $answer_length = $$scantron_config{'Qlength'} * $answers_needed; |
my $answer_length = $$scantron_config{'Qlength'} * $answers_needed; |
|
|
Line 5313 sub scantron_parse_scanline {
|
Line 5316 sub scantron_parse_scanline {
|
} elsif (!defined($currentquest) |
} elsif (!defined($currentquest) |
|| (&occurence_count($currentquest, $$scantron_config{'Qoff'}) == length($currentquest)) |
|| (&occurence_count($currentquest, $$scantron_config{'Qoff'}) == length($currentquest)) |
|| (&occurence_count($currentquest, "[A-Z]") == 0)) { |
|| (&occurence_count($currentquest, "[A-Z]") == 0)) { |
|
&Apache::lonnet::logthis("Missing if, $questnum, $ansnum"); |
for (my $ans = 0; $ans < $answers_needed; $ans++ ) { |
for (my $ans = 0; $ans < $answers_needed; $ans++ ) { |
$record{"scantron.$ansnum.answer"}=''; |
$record{"scantron.$ansnum.answer"}=''; |
$ansnum++; |
$ansnum++; |
|
|
} |
} |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) { |
|
&Apache::lonnet::logthis("Parsed missing: $questnum"); |
push(@{$record{"scantron.missingerror"}},$questnum); |
push(@{$record{"scantron.missingerror"}},$questnum); |
$ansnum += $answers_needed; |
# $ansnum += $answers_needed; |
} |
} |
|
&Apache::lonnet::logthis("Residual scanline: '$questions'"); |
|
|
} else { |
} else { |
for (my $ans = 0; $ans < $answers_needed; $ans++) { |
for (my $ans = 0; $ans < $answers_needed; $ans++) { |
Line 6480 ENDSCRIPT
|
Line 6486 ENDSCRIPT
|
join(',',@{$arg}).'" />'); |
join(',',@{$arg}).'" />'); |
foreach my $question (@{$arg}) { |
foreach my $question (@{$arg}) { |
my $selected = &get_response_bubbles($scan_record, $question); |
my $selected = &get_response_bubbles($scan_record, $question); |
&scantron_bubble_selector($r,$scan_config,$question); |
my @select_array = split(/:/,$selected); # ought to be an array of empties. |
|
&Apache::lonnet::logthis("Calling bubble selector (missing)"); |
|
&scantron_bubble_selector($r,$scan_config,$question, @select_array); |
} |
} |
} else { |
} else { |
$r->print("\n<ul>"); |
$r->print("\n<ul>"); |
Line 6500 ENDSCRIPT
|
Line 6508 ENDSCRIPT
|
$r - Apache request object |
$r - Apache request object |
$scan_config - hash from &get_scantron_config() |
$scan_config - hash from &get_scantron_config() |
$quest - number of the bubble line to make a corrector for |
$quest - number of the bubble line to make a corrector for |
$lines - array of answer lines. |
@lines - array of answer lines. |
|
|
=cut |
=cut |
|
|
Line 6521 sub scantron_bubble_selector {
|
Line 6529 sub scantron_bubble_selector {
|
|
|
my $total_lines = $lines*2; |
my $total_lines = $lines*2; |
my @alphabet=('A'..'Z'); |
my @alphabet=('A'..'Z'); |
|
&Apache::lonnet::logthis("Putting in question number $quest"); |
$r->print("<table border='1'><tr><td rowspan='".$total_lines."'>$quest</td>"); |
$r->print("<table border='1'><tr><td rowspan='".$total_lines."'>$quest</td>"); |
|
|
for (my $l = 0; $l < $lines; $l++) { |
for (my $l = 0; $l < $lines; $l++) { |
Line 6871 sub scantron_validate_missingbubbles {
|
Line 6880 sub scantron_validate_missingbubbles {
|
$scan_data); |
$scan_data); |
if (!defined($$scan_record{'scantron.missingerror'})) { next; } |
if (!defined($$scan_record{'scantron.missingerror'})) { next; } |
my @to_correct; |
my @to_correct; |
|
|
|
# Probably here's where the error is... |
|
|
foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) { |
foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) { |
if ($missing > $max_bubble) { next; } |
if ($missing > $max_bubble) { next; } |
|
&Apache::lonnet::logthis("Marking $missing for missing bubble check"); |
push(@to_correct,$missing); |
push(@to_correct,$missing); |
} |
} |
if (@to_correct) { |
if (@to_correct) { |