[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 29 Jan 2005 00:09:56 -0000
albertel Fri Jan 28 19:09:56 2005 EDT
Modified files:
/loncom/homework grades.pm
Log:
- scantron grading now accepts 'ABAF' etc as the question data format and '1216' (1=A 2=B etc)
- set the Qon to letter or number
- set the Qlength to 1
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.238 loncom/homework/grades.pm:1.239
--- loncom/homework/grades.pm:1.238 Sun Jan 16 03:28:32 2005
+++ loncom/homework/grades.pm Fri Jan 28 19:09:54 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.238 2005/01/16 08:28:32 albertel Exp $
+# $Id: grades.pm,v 1.239 2005/01/29 00:09:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3796,25 +3796,49 @@
my $currentquest=substr($questions,0,$$scantron_config{'Qlength'});
substr($questions,0,$$scantron_config{'Qlength'})='';
if (length($currentquest) < $$scantron_config{'Qlength'}) { next; }
- my @array=split($$scantron_config{'Qon'},$currentquest,-1);
- if (length($array[0]) eq $$scantron_config{'Qlength'}) {
- $record{"scantron.$questnum.answer"}='';
- if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
- push(@{$record{"scantron.missingerror"}},$questnum);
- }
+ if ($$scantron_config{'Qon'} eq 'letter') {
+ if (!$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);
+ }
+ } else {
+ $record{"scantron.$questnum.answer"}=$currentquest;
+ }
+ } elsif ($$scantron_config{'Qon'} eq 'number') {
+ if (!$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);
+ }
+ } else {
+ $record{"scantron.$questnum.answer"}=
+ $alphabet[$currentquest-1];
+ }
} else {
- $record{"scantron.$questnum.answer"}=$alphabet[length($array[0])];
+ my @array=split($$scantron_config{'Qon'},$currentquest,-1);
+ if (length($array[0]) eq $$scantron_config{'Qlength'}) {
+ $record{"scantron.$questnum.answer"}='';
+ if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
+ push(@{$record{"scantron.missingerror"}},$questnum);
+ }
+ } else {
+ $record{"scantron.$questnum.answer"}=
+ $alphabet[length($array[0])];
+ }
+ if (scalar(@array) gt 2) {
+ push(@{$record{'scantron.doubleerror'}},$questnum);
+ my @ans=@array;
+ my $i=length($ans[0]);shift(@ans);
+ while ($#ans) {
+ $i+=length($ans[0])+1;
+ $record{"scantron.$questnum.answer"}.=$alphabet[$i];
+ shift(@ans);
+ }
+ }
}
- if (scalar(@array) gt 2) {
- push(@{$record{'scantron.doubleerror'}},$questnum);
- my @ans=@array;
- my $i=length($ans[0]);shift(@ans);
- while ($#ans) {
- $i+=length($ans[0])+1;
- $record{"scantron.$questnum.answer"}.=$alphabet[$i];
- shift(@ans);
- }
- }
}
$record{'scantron.maxquest'}=$questnum;
return \%record;