[LON-CAPA-cvs] cvs: modules /raeburn neutrinoharvest.pl
raeburn
raeburn@source.lon-capa.org
Mon, 18 Oct 2010 00:26:11 -0000
raeburn Mon Oct 18 00:26:11 2010 EDT
Modified files:
/modules/raeburn neutrinoharvest.pl
Log:
- Bug 5531.
- Now detects case where only difference between past submission
(graded INCORRECT) and submission graded EXACT_ANS for stringresponse
(cs) was presence of Control Characters in earlier submission(s).
Index: modules/raeburn/neutrinoharvest.pl
diff -u modules/raeburn/neutrinoharvest.pl:1.1 modules/raeburn/neutrinoharvest.pl:1.2
--- modules/raeburn/neutrinoharvest.pl:1.1 Fri Oct 15 20:18:25 2010
+++ modules/raeburn/neutrinoharvest.pl Mon Oct 18 00:26:11 2010
@@ -72,7 +72,7 @@
}
}
} else {
- print("Usage: neutrinoharvest.pl <Seconds since last access to filter courses|course_ids e.g., sfu_5H34111eaeeee4b95sful1 sfu_1J125875c1efa4b46sful1>\n");
+ print("Usage: neutrinoharvest.pl <Seconds since last access to filter courses|course_ids e.g., sfu_5H34111eaeeee4b95sful1 sfu_1J125875c1efa4b46sful1>\n");
delete($env{'allowed.bre'});
exit;
}
@@ -161,12 +161,15 @@
my ($prefix,$type) = split(/:/,$item);
if ($history{$prefix.'.awarddetail'} eq 'EXACT_ANS') {
my $correct = $history{$prefix.'.submission'};
- my (@errors,$firstcorrect);
+ $correct =~ s/(^\s+|\s$)//g;
+ my (@errors,$firstcorrect,@had_control_chars);
foreach my $key (sort(keys(%history))) {
if ($key =~ /^(\d+):\Q$prefix\E\.submission$/) {
my $hist = $1;
next if ($firstcorrect && $hist > $firstcorrect);
- if ($history{$key} eq $correct) {
+ my $current = $history{$key};
+ $current =~ s/(^\s+|\s$)//g;
+ if ($current eq $correct) {
my $award = $history{"$hist:$prefix.awarddetail"};
if ($award eq 'INCORRECT') {
push(@errors,$hist);
@@ -179,12 +182,26 @@
}
}
}
+ } elsif ($current =~ /[\000-\037]/) {
+ $current =~ s/[\000-\037]//g;
+ if ($current eq $correct) {
+ my $award = $history{"$hist:$prefix.awarddetail"};
+ if ($award eq 'INCORRECT') {
+ push(@errors,$hist);
+ push(@had_control_chars,$hist);
+ }
+ }
}
}
}
if (@errors > 0) {
@errors = sort {$a <=> $b} @errors;
- print $fh "$cid $stu ".join(',',@errors)." vs $firstcorrect ||$correct|| $symb$prefix\n";
+ my $control_char_msg;
+ if (@had_control_chars > 0) {
+ @had_control_chars = sort {$a <=> $b} @had_control_chars;
+ $control_char_msg = ' (control chars detected in: '.join(',',@had_control_chars).')';
+ }
+ print $fh "$cid $stu ".join(',',@errors)."$control_char_msg vs $firstcorrect ||$correct|| $symb$prefix\n";
}
}
}