[LON-CAPA-cvs] cvs: loncom /homework grades.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 06 Feb 2008 00:39:12 -0000


raeburn		Tue Feb  5 19:39:12 2008 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  More bug 5589.
  - rankresponse type problems also need to be divided into sub-questions, each one with its own scantron bubble line(s) to avoid spurious doublebubble error reports.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.508 loncom/homework/grades.pm:1.509
--- loncom/homework/grades.pm:1.508	Tue Feb  5 13:32:34 2008
+++ loncom/homework/grades.pm	Tue Feb  5 19:39:11 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.508 2008/02/05 18:32:34 www Exp $
+# $Id: grades.pm,v 1.509 2008/02/06 00:39:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4681,9 +4681,10 @@
 
 my %first_bubble_line;             # First bubble line no. for each bubble.
 
-my %subdivided_bubble_lines;       # no. bubble lines for optionresponse 
-                                   # or matchresponse where an individual 
-                                   # response can have multiple lines
+my %subdivided_bubble_lines;       # no. bubble lines for optionresponse, 
+                                   # matchresponse or rankresponse, where 
+                                   # an individual response can have multiple 
+                                   # lines
 
 my %responsetype_per_response;     # responsetype for each response
 
@@ -6792,8 +6793,8 @@
                                   Numbered from 0 (but question numbers are from
                                   1.
    %first_bubble_line           - Starting bubble line for each question.
-   %subdivided_bubble_lines     - optionresponse and matchresponse type
-                                  problems render as separate sub-questions, 
+   %subdivided_bubble_lines     - optionresponse, matchresponse and rankresponse 
+                                  type problems render as separate sub-questions, 
                                   in exam mode. This hash contains a 
                                   comma-separated list of the lines per 
                                   sub-question.
@@ -7113,7 +7114,7 @@
    which are the total number of bubble, lines, the number of bubble
    lines for response n and number of the first bubble line for response n,
    and a comma separated list of numbers of bubble lines for sub-questions
-   (for optionresponse items only), for response n.  
+   (for optionresponse, matchresponse, and rankresponse items), for response n.  
 
 =cut
 
@@ -7186,10 +7187,11 @@
 
 	    # TODO - make this a persistent hash not an array.
 
-            # optionresponse and matchresponse type items render as
-            # separate sub-questions in exam mode.
+            # optionresponse, matchresponse and rankresponse type items 
+            # render as separate sub-questions in exam mode.
             if (($analysis{$part_id.'.type'} eq 'optionresponse') ||
-                ($analysis{$part_id.'.type'} eq 'matchresponse')) {
+                ($analysis{$part_id.'.type'} eq 'matchresponse') ||
+                ($analysis{$part_id.'.type'} eq 'rankresponse')) {
                 my ($numbub,$numshown);
                 if ($analysis{$part_id.'.type'} eq 'optionresponse') {
                     if (ref($analysis{$part_id.'.options'}) eq 'ARRAY') {
@@ -7199,6 +7201,10 @@
                     if (ref($analysis{$part_id.'.items'}) eq 'ARRAY') {
                         $numbub = scalar(@{$analysis{$part_id.'.items'}});
                     }
+                } elsif ($analysis{$part_id.'.type'} eq 'rankresponse') {
+                    if (ref($analysis{$part_id.'.foils'}) eq 'ARRAY') {
+                        $numbub = scalar(@{$analysis{$part_id.'.foils'}});
+                    }
                 }
                 if (ref($analysis{$part_id.'.shown'}) eq 'ARRAY') {
                     $numshown = scalar(@{$analysis{$part_id.'.shown'}});