[LON-CAPA-cvs] cvs: loncom /homework grades.pm
foxr
lon-capa-cvs-allow@mail.lon-capa.org
Mon, 29 Oct 2007 09:46:31 -0000
foxr Mon Oct 29 05:46:31 2007 EDT
Modified files:
/loncom/homework grades.pm
Log:
BZ4074 - missing bubbles appear to be correctly reported.
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.469 loncom/homework/grades.pm:1.470
--- loncom/homework/grades.pm:1.469 Fri Oct 26 16:18:43 2007
+++ loncom/homework/grades.pm Mon Oct 29 05:46:28 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.469 2007/10/26 20:18:43 albertel Exp $
+# $Id: grades.pm,v 1.470 2007/10/29 09:46:28 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5239,6 +5239,7 @@
sub scantron_parse_scanline {
my ($line,$whichline,$scantron_config,$scan_data,$just_header)=@_;
+
my %record;
my $questions=substr($line,$$scantron_config{'Qstart'}-1); # Answers
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); # earlier stuff
@@ -5277,7 +5278,9 @@
my $questnum=0;
my $ansnum =1; # Multiple 'answer lines'/question.
- while ($questions) {
+ chomp($questions); # Get rid of any trailing \n.
+ $questions =~ s/\r$//; # Get rid of trailing \r too (MAC or Win uploads).
+ while (length($questions)) {
my $answers_needed = $bubble_lines_per_response{$questnum};
my $answer_length = $$scantron_config{'Qlength'} * $answers_needed;
@@ -5313,15 +5316,18 @@
} elsif (!defined($currentquest)
|| (&occurence_count($currentquest, $$scantron_config{'Qoff'}) == length($currentquest))
|| (&occurence_count($currentquest, "[A-Z]") == 0)) {
+ &Apache::lonnet::logthis("Missing if, $questnum, $ansnum");
for (my $ans = 0; $ans < $answers_needed; $ans++ ) {
$record{"scantron.$ansnum.answer"}='';
$ansnum++;
}
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
+ &Apache::lonnet::logthis("Parsed missing: $questnum");
push(@{$record{"scantron.missingerror"}},$questnum);
- $ansnum += $answers_needed;
+ # $ansnum += $answers_needed;
}
+ &Apache::lonnet::logthis("Residual scanline: '$questions'");
} else {
for (my $ans = 0; $ans < $answers_needed; $ans++) {
@@ -6480,7 +6486,9 @@
join(',',@{$arg}).'" />');
foreach my $question (@{$arg}) {
my $selected = &get_response_bubbles($scan_record, $question);
- &scantron_bubble_selector($r,$scan_config,$question);
+ my @select_array = split(/:/,$selected); # ought to be an array of empties.
+ &Apache::lonnet::logthis("Calling bubble selector (missing)");
+ &scantron_bubble_selector($r,$scan_config,$question, @select_array);
}
} else {
$r->print("\n<ul>");
@@ -6500,7 +6508,7 @@
$r - Apache request object
$scan_config - hash from &get_scantron_config()
$quest - number of the bubble line to make a corrector for
- $lines - array of answer lines.
+ @lines - array of answer lines.
=cut
@@ -6521,6 +6529,7 @@
my $total_lines = $lines*2;
my @alphabet=('A'..'Z');
+ &Apache::lonnet::logthis("Putting in question number $quest");
$r->print("<table border='1'><tr><td rowspan='".$total_lines."'>$quest</td>");
for (my $l = 0; $l < $lines; $l++) {
@@ -6871,8 +6880,12 @@
$scan_data);
if (!defined($$scan_record{'scantron.missingerror'})) { next; }
my @to_correct;
+
+ # Probably here's where the error is...
+
foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) {
if ($missing > $max_bubble) { next; }
+ &Apache::lonnet::logthis("Marking $missing for missing bubble check");
push(@to_correct,$missing);
}
if (@to_correct) {