[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sun, 05 Jun 2005 06:12:18 -0000
albertel Sun Jun 5 02:12:18 2005 EDT
Modified files:
/loncom/homework grades.pm
Log:
- from ray - bubble selector was only allowing you to pick 'A' for letter/numbe stle scantron files
- handle lette/number double files which put a ? to denote double bubbles
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.273 loncom/homework/grades.pm:1.274
--- loncom/homework/grades.pm:1.273 Sat Jun 4 15:05:31 2005
+++ loncom/homework/grades.pm Sun Jun 5 02:12:16 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.273 2005/06/04 19:05:31 albertel Exp $
+# $Id: grades.pm,v 1.274 2005/06/05 06:12:16 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4108,7 +4108,14 @@
&scan_data($scan_data,
"$whichline.no_bubble.".$args->{'question'},'1');
} else {
- substr($answer,$args->{'response'},1)=$on;
+ if ($on eq 'letter') {
+ my @alphabet=('A'..'Z');
+ $answer=$alphabet[$args->{'response'}];
+ } elsif ($on eq 'number') {
+ $answer=$args->{'response'}+1;
+ } else {
+ substr($answer,$args->{'response'},1)=$on;
+ }
&scan_data($scan_data,
"$whichline.no_bubble.".$args->{'question'},undef,'1');
}
@@ -4169,8 +4176,12 @@
substr($questions,0,$$scantron_config{'Qlength'})='';
if (length($currentquest) < $$scantron_config{'Qlength'}) { next; }
if ($$scantron_config{'Qon'} eq 'letter') {
- if (!$currentquest || $currentquest eq $$scantron_config{'Qoff'} ||
- $currentquest !~ /^[A-Z]$/) {
+ if ($currentquest eq '?') {
+ push(@{$record{'scantron.doubleerror'}},$questnum);
+ $record{"scantron.$questnum.answer"}='';
+ } elsif (!$currentquest
+ || $currentquest eq $$scantron_config{'Qoff'}
+ || $currentquest !~ /^[A-Z]$/) {
$record{"scantron.$questnum.answer"}='';
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
push(@{$record{"scantron.missingerror"}},$questnum);
@@ -4179,8 +4190,12 @@
$record{"scantron.$questnum.answer"}=$currentquest;
}
} elsif ($$scantron_config{'Qon'} eq 'number') {
- if (!$currentquest || $currentquest eq $$scantron_config{'Qoff'} ||
- $currentquest !~ /^\d$/) {
+ if ($currentquest eq '?') {
+ push(@{$record{'scantron.doubleerror'}},$questnum);
+ $record{"scantron.$questnum.answer"}='';
+ } elsif (!$currentquest
+ || $currentquest eq $$scantron_config{'Qoff'}
+ || $currentquest !~ /^\d$/) {
$record{"scantron.$questnum.answer"}='';
if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
push(@{$record{"scantron.missingerror"}},$questnum);
@@ -4804,17 +4819,22 @@
sub scantron_bubble_selector {
my ($r,$scan_config,$quest,@selected)=@_;
my $max=$$scan_config{'Qlength'};
+
+ my $scmode=$$scan_config{'Qon'};
+ if ($scmode eq 'number' || $scmode eq 'letter') { $max=10; }
+
my @alphabet=('A'..'Z');
$r->print("<table border='1'><tr><td rowspan='2'>$quest</td>");
for (my $i=0;$i<$max+1;$i++) {
- $r->print('<td align="center">');
+ $r->print("\n".'<td align="center">');
if ($selected[0] eq $alphabet[$i]) { $r->print('X'); shift(@selected) }
else { $r->print(' '); }
$r->print('</td>');
}
- $r->print('<td></td></tr><tr>');
+ $r->print('</tr><tr>');
for (my $i=0;$i<$max;$i++) {
- $r->print('<td><label><input type="radio" name="scantron_correct_Q_'.
+ $r->print("\n".
+ '<td><label><input type="radio" name="scantron_correct_Q_'.
$quest.'" value="'.$i.'" />'.$alphabet[$i]."</label></td>");
}
$r->print('<td><label><input type="radio" name="scantron_correct_Q_'.