[LON-CAPA-cvs] cvs: loncom /homework grades.pm response.pm
foxr
lon-capa-cvs-allow@mail.lon-capa.org
Tue, 13 Nov 2007 11:06:57 -0000
foxr Tue Nov 13 06:06:57 2007 EDT
Modified files:
/loncom/homework grades.pm response.pm
Log:
BZ4074 - Tested for multiquestion exams.
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.489 loncom/homework/grades.pm:1.490
--- loncom/homework/grades.pm:1.489 Mon Nov 12 20:47:36 2007
+++ loncom/homework/grades.pm Tue Nov 13 06:06:54 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.489 2007/11/13 01:47:36 albertel Exp $
+# $Id: grades.pm,v 1.490 2007/11/13 11:06:54 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5406,10 +5406,9 @@
my $answer_length = $$scantron_config{'Qlength'} * $answers_needed;
-
$questnum++;
my $currentquest = substr($questions,0,$answer_length);
- $questions = substr($questions,0,$answer_length)='';
+ $questions = substr($questions,$answer_length);
if (length($currentquest) < $answer_length) { next; }
# Qon letter implies for each slot in currentquest we have:
@@ -5419,7 +5418,6 @@
if ($$scantron_config{'Qon'} eq 'letter') {
-
if ($currentquest =~ /\?/
|| $currentquest =~ /\*/
|| (&occurence_count($currentquest, "[A-Z]") > 1)) {
@@ -5448,7 +5446,8 @@
}
} else {
for (my $ans = 0; $ans < $answers_needed; $ans++) {
- $record{"scantron.$ansnum.answer"} = substr($currentquest, $ans, 1);
+ my $bubble = substr($currentquest, $ans, 1);
+ $record{"scantron.$ansnum.answer"} = $bubble;
$ansnum++;
}
}
@@ -5515,10 +5514,9 @@
push(@{$record{"scantron.missingerror"}},$questnum);
}
- # If the bubble is not the last position, there will be
- # 2 elements. If it is the last position, there will be 1 element.
- } elsif (scalar(@array) le 2) {
+
+ } elsif (scalar(@array) eq 2) {
my $location = length($array[0]);
my $line_num = int($location / $$scantron_config{'Qlength'});
@@ -6951,9 +6949,10 @@
foreach my $part_id (@{$analysis{'parts'}}) {
-
my $lines = $analysis{"$part_id.bubble_lines"};;
+
+
# TODO - make this a persistent hash not an array.
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.183 loncom/homework/response.pm:1.184
--- loncom/homework/response.pm:1.183 Tue Nov 6 06:48:48 2007
+++ loncom/homework/response.pm Tue Nov 13 06:06:54 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.183 2007/11/06 11:48:48 foxr Exp $
+# $Id: response.pm,v 1.184 2007/11/13 11:06:54 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -884,7 +884,6 @@
if (!defined($lines)) {
$lines = 1;
}
-
my %let_to_num=('A'=>0,'B'=>1,'C'=>2,'D'=>3,'E'=>4,'F'=>5,'G'=>6,'H'=>7,
'I'=>8,'J'=>9,'K'=>10,'L'=>11,'M'=>12,'N'=>13,'O'=>14,
'P'=>15,'Q'=>16,'R'=>17,'S'=>18,'T'=>19,'U'=>20,'V'=>21,
@@ -895,10 +894,9 @@
my $line;
for ($line = 0; $line < $lines; $line++) {
- $response = $env{'scantron.'.
- ($Apache::lonxml::counter+$offset-1+$line).
- '.answer'};
- if ((defined($response)) && ($response ne " ")) {
+ my $theline = $Apache::lonxml::counter+$offset-1+$line;
+ $response = $env{"scantron.$theline.answer"};
+ if ((defined($response)) && ($response ne "") && ($response ne " ")) {
last;
}