version 1.1403, 2019/01/27 23:16:36
|
version 1.1404, 2019/01/28 21:37:03
|
Line 4361 sub bubblesheet_converter {
|
Line 4361 sub bubblesheet_converter {
|
if ((&domain($cdom) ne '') && |
if ((&domain($cdom) ne '') && |
($fullpath =~ m{^\Q$perlvar{'lonDocRoot'}/userfiles/$cdom/\E$match_courseid/scantron_orig}) && |
($fullpath =~ m{^\Q$perlvar{'lonDocRoot'}/userfiles/$cdom/\E$match_courseid/scantron_orig}) && |
(-e $fullpath) && (ref($config) eq 'HASH') && ($format ne '')) { |
(-e $fullpath) && (ref($config) eq 'HASH') && ($format ne '')) { |
my %csvcols = %{$config}; |
my (%csvcols,%csvoptions); |
|
if (ref($config->{'fields'}) eq 'HASH') { |
|
%csvcols = %{$config->{'fields'}}; |
|
} |
|
if (ref($config->{'options'}) eq 'HASH') { |
|
%csvoptions = %{$config->{'options'}}; |
|
} |
my %csvbynum = reverse(%csvcols); |
my %csvbynum = reverse(%csvcols); |
my %scantronconf = &get_scantron_config($format,$cdom); |
my %scantronconf = &get_scantron_config($format,$cdom); |
if (keys(%scantronconf)) { |
if (keys(%scantronconf)) { |
Line 4397 sub bubblesheet_converter {
|
Line 4403 sub bubblesheet_converter {
|
my %lettdig = &letter_to_digits(); |
my %lettdig = &letter_to_digits(); |
my %diglett = reverse(%lettdig); |
my %diglett = reverse(%lettdig); |
my $numletts = scalar(keys(%lettdig)); |
my $numletts = scalar(keys(%lettdig)); |
|
my $num = 0; |
while (my $line=<$fh>) { |
while (my $line=<$fh>) { |
|
$num ++; |
|
next if (($num == 1) && ($csvoptions{'hdr'} == 1)); |
$line =~ s{[\r\n]+$}{}; |
$line =~ s{[\r\n]+$}{}; |
my %found; |
my %found; |
my @values = split(/,/,$line); |
my @values = split(/,/,$line); |
Line 4454 sub bubblesheet_converter {
|
Line 4463 sub bubblesheet_converter {
|
$found{'FirstQuestion'} .= $values[$i]; |
$found{'FirstQuestion'} .= $values[$i]; |
} |
} |
} elsif (exists($csvbynum{$i})) { |
} elsif (exists($csvbynum{$i})) { |
$values[$i] =~ s/^\s+//; |
if ($csvoptions{'rem'}) { |
if ($csvbynum{$i} eq 'PaperID') { |
$values[$i] =~ s/^\s+//; |
|
} |
|
if (($csvbynum{$i} eq 'PaperID') && ($csvoptions{'pad'})) { |
while (length($values[$i]) < $scantronconf{$maplength{$csvbynum{$i}}}) { |
while (length($values[$i]) < $scantronconf{$maplength{$csvbynum{$i}}}) { |
$values[$i] = '0'.$values[$i]; |
$values[$i] = '0'.$values[$i]; |
} |
} |