[LON-CAPA-cvs] cvs: loncom /homework grades.pm
foxr
lon-capa-cvs-allow@mail.lon-capa.org
Wed, 17 Oct 2007 10:48:27 -0000
foxr Wed Oct 17 06:48:27 2007 EDT
Modified files:
/loncom/homework grades.pm
Log:
Fix errors in handling of scantron_bubble_selector when mutiple lines of
bubbles are needed to handle the response. Need to test cases where
replies are letters and positional notation still.
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.460 loncom/homework/grades.pm:1.461
--- loncom/homework/grades.pm:1.460 Wed Oct 17 05:40:49 2007
+++ loncom/homework/grades.pm Wed Oct 17 06:48:20 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.460 2007/10/17 09:40:49 foxr Exp $
+# $Id: grades.pm,v 1.461 2007/10/17 10:48:20 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -91,7 +91,7 @@
my $selected = "";
for (my $bline = 0; $bline < $bubble_lines; $bline++) {
- $selected .= $$parsed_line{"scantron.$bubble_line.answer"};
+ $selected .= $$parsed_line{"scantron.$bubble_line.answer"}.":";
$bubble_line++;
}
return $selected;
@@ -5312,7 +5312,7 @@
if ($bubble =~ /\d/) {
$record{"scantron.$ansnum.answer"} = $alphabet[$bubble];
} else {
- $record{"scantron.$ansnum.answer"}='';
+ $record{"scantron.$ansnum.answer"}=' ';
}
$ansnum++;
}
@@ -6432,7 +6432,7 @@
$r->print("<p>Please indicate which bubble should be used for grading</p>");
foreach my $question (@{$arg}) {
my $selected = &get_response_bubbles($scan_record, $question);
- my @select_array = split('',$selected);
+ my @select_array = split(/:/,$selected);
&scantron_bubble_selector($r,$scan_config,$question,
@select_array);
}
@@ -6465,17 +6465,18 @@
$r - Apache request object
$scan_config - hash from &get_scantron_config()
$quest - number of the bubble line to make a corrector for
- $selected - array of letters of previously selected bubbles
+ $lines - array of answer lines.
=cut
sub scantron_bubble_selector {
- my ($r,$scan_config,$quest,@selected)=@_;
+ my ($r,$scan_config,$quest,@lines)=@_;
my $max=$$scan_config{'Qlength'};
+
my $scmode=$$scan_config{'Qon'};
- my $bubble_length = scalar(@selected);
+ my $bubble_length = scalar(@lines);
if ($scmode eq 'number' || $scmode eq 'letter') { $max=10; }
@@ -6491,8 +6492,8 @@
if ($l != 0) {
$r->print('<tr>');
}
-
for (my $i=0;$i<$max;$i++) {
+ my @selected = split(//,$lines[$l]);
$r->print("\n".'<td align="center">');
if ($selected[0] eq $alphabet[$i]) {
$r->print('X');