[LON-CAPA-cvs] cvs: loncom(version_1_0_2_scantron) /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 29 Sep 2003 21:31:30 -0000
albertel Mon Sep 29 17:31:30 2003 EDT
Modified files: (Branch: version_1_0_2_scantron)
/loncom/homework grades.pm
Log:
- can really mark a line as blank now,
- validation passes look good
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.130.2.1.2.5 loncom/homework/grades.pm:1.130.2.1.2.6
--- loncom/homework/grades.pm:1.130.2.1.2.5 Mon Sep 29 16:58:50 2003
+++ loncom/homework/grades.pm Mon Sep 29 17:31:30 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.130.2.1.2.5 2003/09/29 20:58:50 albertel Exp $
+# $Id: grades.pm,v 1.130.2.1.2.6 2003/09/29 21:31:30 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3276,7 +3276,7 @@
}
sub scantron_fixup_scanline {
- my ($scantron_config,$scan_data,$line,$field,$newvalue,$arg) = @_;
+ my ($scantron_config,$scan_data,$line,$whichline,$field,$newvalue,$arg)=@_;
if ($field eq 'ID') {
if ($newvalue > $$scantron_config{'IDlength'}) {
return ($line,1,'New value to large');
@@ -3292,11 +3292,11 @@
my $off=$scantron_config->{'Qoff'};
my $on=$scantron_config->{'Qon'};
my $answer=${off}x$length;
- if ($arg ne 'none') {
- substr($answer,$arg,1)=$on;
- &scan_data($scan_data,"no_bubble.$newvalue",undef,'1');
+ if ($arg eq 'none') {
+ &scan_data($scan_data,"$whichline.no_bubble.$newvalue",'1');
} else {
- &scan_data($scan_data,"no_bubble.$newvalue",'1');
+ substr($answer,$arg,1)=$on;
+ &scan_data($scan_data,"$whichline.no_bubble.$newvalue",undef,'1');
}
my $where=$length*($newvalue-1)+$scantron_config->{'Qstart'};
Apache->request->print("where $where arg $arg ");
@@ -3308,7 +3308,7 @@
}
sub scan_data {
- my ($scan_data,$key,$value,$delete);
+ my ($scan_data,$key,$value,$delete)=@_;
my $filename=$ENV{'form.scantron_selectfile'};
if (defined($value)) {
$scan_data->{$filename.'_'.$key} = $value;
@@ -3318,7 +3318,7 @@
}
sub scantron_parse_scanline {
- my ($line,$scantron_config,$scan_data)=@_;
+ my ($line,$whichline,$scantron_config,$scan_data)=@_;
my %record;
my $questions=substr($line,$$scantron_config{'Qstart'}-1);
my $data=substr($line,0,$$scantron_config{'Qstart'}-1);
@@ -3351,7 +3351,7 @@
my @array=split($$scantron_config{'Qon'},$currentquest,-1);
if (length($array[0]) eq $$scantron_config{'Qlength'}) {
$record{"scantron.$questnum.answer"}='';
- if (!&scan_data($scan_data,"no_bubble.$questnum")) {
+ if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
push(@{$record{"scantron.missingerror"}},$questnum);
}
} else {
@@ -3425,13 +3425,13 @@
$ENV{'form.scantron_domain'};
my $newid=$classlist->{$newstudent}->[&Apache::loncoursedata::CL_ID];
($line,$err,$errmsg)=
- &scantron_fixup_scanline(\%scantron_config,$scan_data,$line,'ID',
- $newid);
+ &scantron_fixup_scanline(\%scantron_config,$scan_data,$line,$which,
+ 'ID',$newid);
} elsif ($ENV{'form.scantron_corrections'} =~ /^(missing|double)bubble$/) {
foreach my $question (split(',',$ENV{'form.scantron_questions'})) {
($line,$err,$errmsg)=
&scantron_fixup_scanline(\%scantron_config,$scan_data,$line,
- 'answer',$question,
+ $which,'answer',$question,
$ENV{"form.scantron_correct_Q_$question"});
if ($err) { last; }
}
@@ -3586,7 +3586,8 @@
for (my $i=0;$i<=$scanlines->{'count'};$i++) {
my $line=&scantron_get_line($scanlines,$i);
if (!$line) { next; }
- my $scan_record=&scantron_parse_scanline($line,\%scantron_config,$scan_data);
+ my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
+ $scan_data);
my $id=$$scan_record{'scantron.ID'};
$r->print("<p>Checking ID ".$$scan_record{'scantron.ID'}.
" on paper ID ".$$scan_record{'scantron.PaperID'}."</p>\n");
@@ -3713,7 +3714,8 @@
for (my $i=0;$i<=$scanlines->{'count'};$i++) {
my $line=&scantron_get_line($scanlines,$i);
if (!$line) { next; }
- my $scan_record=&scantron_parse_scanline($line,\%scantron_config,$scan_data);
+ my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
+ $scan_data);
if (!defined($$scan_record{'scantron.doubleerror'})) { next; }
&scantron_get_correction($r,$i,$scan_record,\%scantron_config,$line,
'doublebubble',
@@ -3737,7 +3739,8 @@
for (my $i=0;$i<=$scanlines->{'count'};$i++) {
my $line=&scantron_get_line($scanlines,$i);
if (!$line) { next; }
- my $scan_record=&scantron_parse_scanline($line,\%scantron_config,$scan_data);
+ my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
+ $scan_data);
if (!defined($$scan_record{'scantron.missingerror'})) { next; }
my @to_correct;
foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) {
@@ -3795,7 +3798,8 @@
my $line=&scantron_get_line($scanlines,$i);
if (!$line) { next; }
$r->print('<pre>line is'.$line.'</pre>');
- my $scan_record=&scantron_parse_scanline($line,\%scantron_config,$scan_data);
+ my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
+ $scan_data);
my ($uname,$udom);
unless ($uname=&scantron_find_student($scan_record,\%idmap)) {
&scantron_add_delay(\@delayqueue,$line,
@@ -4165,6 +4169,7 @@
#remotewindow.close();
#</script>");
$request->print(&Apache::loncommon::bodytag('Grading'));
+ $request->rflush();
}
sub send_footer {