';
- my ($depth,$question) = (1,1);
+ my ($depth,$question,$prob) = (1,1,1);
$iterator->next(); # skip the first BEGIN_MAP
my $curRes = $iterator->next(); # for "current resource"
while ($depth > 0) {
@@ -3119,7 +3121,7 @@ sub displayPage {
my $parts = $curRes->parts();
my $title = $curRes->compTitle();
my $symbx = $curRes->symb();
- $studentTable.='
The encoded CODE has also been used by a previous paper $arg, and CODEs were supposed to be unique
\n");
+ $r->print("
The encoded CODE has also been used by a previous paper ".join(', ',@{$arg}).", and CODEs are supposed to be unique
\n");
}
$r->print("
The CODE on the form is ".
$$scan_record{'scantron.CODE'}." \n");
@@ -4178,8 +4254,21 @@ sub scantron_get_correction {
$$scan_record{'scantron.FirstName'}."
");
$r->print("
How should I handle this? \n");
$r->print("\n ");
- $r->print(" Use the CODE ".$$scan_record{'scantron.CODE'}." that is was on the paper, ignoring the error.");
+ my $i=0;
+ if ($error eq 'incorrectCODE') {
+ my ($max,$closest)=&scantron_get_closely_matching_CODEs($arg,$$scan_record{'scantron.CODE'});
+ foreach my $testcode (@{$closest}) {
+ my $checked='';
+ if (!$i) { $checked=' checked="on" '; }
+ $r->print(" Use the similar CODE ".$testcode." instead.");
+ $r->print("\n ");
+ $i++;
+ }
+ }
+ my $checked; if (!$i) { $checked=' checked="on" '; }
+ $r->print(" Use the CODE ".$$scan_record{'scantron.CODE'}." that is was on the paper, ignoring the error.");
$r->print("\n ");
+
$r->print(<
function change_radio(field) {
@@ -4202,7 +4291,6 @@ ENDSCRIPT
$r->print(" Use as the CODE.");
$r->print("\n
");
} elsif ($error eq 'doublebubble') {
-#FIXME Need to print out who this is along with the paper info
$r->print("
There have been multiple bubbles scanned for a some question(s)
\n");
$r->print('');
@@ -4249,9 +4337,38 @@ sub scantron_bubble_selector {
$r->print('
');
}
+sub num_matches {
+ my ($orig,$code) = @_;
+ my @code=split(//,$code);
+ my @orig=split(//,$orig);
+ my $same=0;
+ for (my $i=0;$i{'count'};$i++) {
- my $line=&scantron_get_line($scanlines,$i);
+ my $line=&scantron_get_line($scanlines,$scan_data,$i);
if ($line=~/^[\s\cz]*$/) { next; }
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
$scan_data);
@@ -4282,17 +4395,17 @@ sub scantron_validate_CODE {
if (!exists($allcodes{$CODE}) && !$$scan_record{'scantron.useCODE'}) {
&scantron_get_correction($r,$i,$scan_record,
\%scantron_config,
- $line,'incorrectCODE',$CODE);
- return(1);
+ $line,'incorrectCODE',\%allcodes);
+ return(1,$currentphase);
}
if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'}
&& !$$scan_record{'scantron.CODE_ignore_dup'}) {
&scantron_get_correction($r,$i,$scan_record,
\%scantron_config,
- $line,'duplicateCODE',$CODE);
- return(1);
+ $line,'duplicateCODE',$usedCODEs{$CODE});
+ return(1,$currentphase);
}
- $usedCODEs{$CODE}++;
+ push (@{$usedCODEs{$CODE}},$$scan_record{'scantron.PaperID'});
}
return (0,$currentphase+1);
}
@@ -4307,7 +4420,7 @@ sub scantron_validate_doublebubble {
my %scantron_config=&get_scantron_config($ENV{'form.scantron_format'});
my ($scanlines,$scan_data)=&scantron_getfile();
for (my $i=0;$i<=$scanlines->{'count'};$i++) {
- my $line=&scantron_get_line($scanlines,$i);
+ my $line=&scantron_get_line($scanlines,$scan_data,$i);
if ($line=~/^[\s\cz]*$/) { next; }
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
$scan_data);
@@ -4357,7 +4470,7 @@ sub scantron_validate_missingbubbles {
my $max_bubble=&scantron_get_maxbubble();
if (!$max_bubble) { $max_bubble=2**31; }
for (my $i=0;$i<=$scanlines->{'count'};$i++) {
- my $line=&scantron_get_line($scanlines,$i);
+ my $line=&scantron_get_line($scanlines,$scan_data,$i);
if ($line=~/^[\s\cz]*$/) { next; }
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
$scan_data);
@@ -4402,18 +4515,25 @@ SCANTRONFORM
my @delayqueue;
my %completedstudents;
+ my $count=&get_todo_count($scanlines,$scan_data);
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Scantron Status',
- 'Scantron Progress',$scanlines->{'count'});
+ 'Scantron Progress',$count,
+ 'inline',undef,'scantronupload');
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
'Processing first student');
my $start=&Time::HiRes::time();
my $i=-1;
- my ($uname,$udom);
+ my ($uname,$udom,$started);
while ($i<$scanlines->{'count'}) {
($uname,$udom)=('','');
$i++;
- my $line=&scantron_get_line($scanlines,$i);
+ my $line=&scantron_get_line($scanlines,$scan_data,$i);
if ($line=~/^[\s\cz]*$/) { next; }
+ if ($started) {
+ &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
+ 'last student');
+ }
+ $started=1;
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
$scan_data);
unless ($uname=&scantron_find_student($scan_record,$scan_data,
@@ -4434,27 +4554,30 @@ SCANTRONFORM
my $i=0;
foreach my $resource (@resources) {
$i++;
- my $result=&Apache::lonnet::ssi($resource->src(),
- ('submitted' =>'scantron',
- 'grade_target' =>'grade',
- 'grade_username'=>$uname,
- 'grade_domain' =>$udom,
- 'grade_courseid'=>$ENV{'request.course.id'},
- 'grade_symb' =>$resource->symb()));
+ my %form=('submitted' =>'scantron',
+ 'grade_target' =>'grade',
+ 'grade_username'=>$uname,
+ 'grade_domain' =>$udom,
+ 'grade_courseid'=>$ENV{'request.course.id'},
+ 'grade_symb' =>$resource->symb());
+ if (exists($scan_record->{'scantron.CODE'}) &&
+ $scan_record->{'scantron.CODE'}) {
+ $form{'CODE'}=$scan_record->{'scantron.CODE'};
+ }
+ my $result=&Apache::lonnet::ssi($resource->src(),%form);
+
}
$completedstudents{$uname}={'line'=>$line};
} continue {
&Apache::lonnet::delenv('form.counter');
&Apache::lonnet::delenv('scantron\.');
- &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
- 'last student');
}
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
# my $lasttime = &Time::HiRes::time()-$start;
# $r->print("