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");
@@ -4133,8 +4171,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) {
@@ -4157,7 +4208,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('');
@@ -4204,9 +4254,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++) {
@@ -4237,16 +4312,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'}) {
+ 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);
}
@@ -4357,7 +4433,8 @@ SCANTRONFORM
my %completedstudents;
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Scantron Status',
- 'Scantron Progress',$scanlines->{'count'});
+ 'Scantron Progress',$scanlines->{'count'},
+ 'inline',undef,'scantronupload');
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
'Processing first student');
my $start=&Time::HiRes::time();
@@ -4388,13 +4465,18 @@ 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 {