[LON-CAPA-cvs] cvs: loncom(version_2_1_X) /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 22 Sep 2006 21:16:16 -0000
albertel Fri Sep 22 17:16:16 2006 EDT
Modified files: (Branch: version_2_1_X)
/loncom/homework grades.pm
Log:
- backport 1.376
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.302.2.6 loncom/homework/grades.pm:1.302.2.7
--- loncom/homework/grades.pm:1.302.2.6 Mon May 29 14:51:35 2006
+++ loncom/homework/grades.pm Fri Sep 22 17:16:14 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.302.2.6 2006/05/29 18:51:35 albertel Exp $
+# $Id: grades.pm,v 1.302.2.7 2006/09/22 21:16:14 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4517,21 +4517,29 @@
&scantron_putfile(undef,$scan_data);
}
-sub allow_skipping {
+sub start_skipping {
my ($scan_data,$i)=@_;
my %remembered=split(':',&scan_data($scan_data,'remember_skipping'));
- delete($remembered{$i});
+ if ($env{'form.scantron_options_redo'} =~ /^redo_/) {
+ $remembered{$i}=2;
+ } else {
+ $remembered{$i}=1;
+ }
&scan_data($scan_data,'remember_skipping',join(':',%remembered));
}
sub should_be_skipped {
- my ($scan_data,$i)=@_;
+ my ($scanlines,$scan_data,$i)=@_;
if ($env{'form.scantron_options_redo'} !~ /^redo_/) {
# not redoing old skips
+ if ($scanlines->{'skipped'}[$i]) { return 1; }
return 0;
}
my %remembered=split(':',&scan_data($scan_data,'remember_skipping'));
- if (exists($remembered{$i})) { return 0; }
+
+ if (exists($remembered{$i}) && $remembered{$i} != 2 ) {
+ return 0;
+ }
return 1;
}
@@ -4543,7 +4551,7 @@
$to_remember{$i}=1;
}
}
- &Apache::lonnet::logthis('remembering '.join(':',%to_remember));
+
&scan_data($scan_data,'remember_skipping',join(':',%to_remember));
&scantron_putfile(undef,$scan_data);
}
@@ -4648,7 +4656,6 @@
}
if ($env{'form.scantron_options_redo'} eq 'redo_skipped') {
&remember_current_skipped();
- &scantron_remove_file('skipped');
$env{'form.scantron_options_redo'}='redo_skipped_ready';
}
@@ -4811,8 +4818,8 @@
sub scantron_get_line {
my ($scanlines,$scan_data,$i)=@_;
- if (&should_be_skipped($scan_data,$i)) { return undef; }
- if ($scanlines->{'skipped'}[$i]) { return undef; }
+ if (&should_be_skipped($scanlines,$scan_data,$i)) { return undef; }
+ #if ($scanlines->{'skipped'}[$i]) { return undef; }
if ($scanlines->{'corrected'}[$i]) {return $scanlines->{'corrected'}[$i];}
return $scanlines->{'orig'}[$i];
}
@@ -4832,12 +4839,21 @@
my ($scanlines,$scan_data,$i,$newline,$skip)=@_;
if ($skip) {
$scanlines->{'skipped'}[$i]=$newline;
- &allow_skipping($scan_data,$i);
+ &start_skipping($scan_data,$i);
return;
}
$scanlines->{'corrected'}[$i]=$newline;
}
+sub scantron_clear_skip {
+ my ($scanlines,$scan_data,$i)=@_;
+ if (exists($scanlines->{'skipped'}[$i])) {
+ undef($scanlines->{'skipped'}[$i]);
+ return 1;
+ }
+ return 0;
+}
+
sub scantron_validate_ID {
my ($r,$currentphase) = @_;
@@ -5281,6 +5297,10 @@
($uname,$udom)=split(/:/,$uname);
&Apache::lonnet::delenv('form.counter');
&Apache::lonnet::appenv(%$scan_record);
+
+ if (&scantron_clear_skip($scanlines,$scan_data,$i)) {
+ &scantron_putfile($scanlines,$scan_data);
+ }
my $i=0;
foreach my $resource (@resources) {