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

raeburn raeburn@source.lon-capa.org
Mon, 22 Dec 2008 14:55:29 -0000


raeburn		Mon Dec 22 14:55:29 2008 EDT

  Modified files:              
    /loncom/homework	chemresponse.pm essayresponse.pm grades.pm 
  Log:
  - Bug 5850.
    - add $partid.$id for essayresponse, reactionresponse and organicresponse to $Apache::lonhomework::analyze{"parts"} arrayref so they are available in grades::scantron_get_maxbubble() when determing bubble lines for each problem part.
  
  
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.83 loncom/homework/chemresponse.pm:1.84
--- loncom/homework/chemresponse.pm:1.83	Thu Dec 11 14:52:30 2008
+++ loncom/homework/chemresponse.pm	Mon Dec 22 14:55:28 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.83 2008/12/11 14:52:30 bisitz Exp $
+# $Id: chemresponse.pm,v 1.84 2008/12/22 14:55:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -338,6 +338,7 @@
 					   "$partid.$id"); # part.response
 	if ($target eq 'analyze') {
             $Apache::lonhomework::analyze{"$partid.$id.type"} = 'organicresponse';
+            push (@{ $Apache::lonhomework::analyze{"parts"} },"$partid.$id");
 	    &Apache::lonhomework::set_bubble_lines();
 	}
     }
@@ -580,6 +581,7 @@
 	&Apache::lonxml::increment_counter(&Apache::response::repetition(), "$partid.$id");
         if ($target eq 'analyze') {
             $Apache::lonhomework::analyze{"$partid.$id.type"} = 'reactionresponse';
+            push (@{ $Apache::lonhomework::analyze{"parts"} },"$partid.$id");
             &Apache::lonhomework::set_bubble_lines();
         }
     }
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.95 loncom/homework/essayresponse.pm:1.96
--- loncom/homework/essayresponse.pm:1.95	Sun Dec 21 19:09:15 2008
+++ loncom/homework/essayresponse.pm	Mon Dec 22 14:55:28 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # essay (ungraded) style responses
 #
-# $Id: essayresponse.pm,v 1.95 2008/12/21 19:09:15 raeburn Exp $
+# $Id: essayresponse.pm,v 1.96 2008/12/22 14:55:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -203,6 +203,7 @@
 
 	if ($target eq 'analyze') {
             $Apache::lonhomework::analyze{"$part.$id.type"} = 'essayresponse';
+            push (@{ $Apache::lonhomework::analyze{"parts"} },"$part.$id");
 	    &Apache::lonhomework::set_bubble_lines();
 	}
     }
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.540 loncom/homework/grades.pm:1.541
--- loncom/homework/grades.pm:1.540	Sun Dec 21 22:26:48 2008
+++ loncom/homework/grades.pm	Mon Dec 22 14:55:28 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.540 2008/12/21 22:26:48 riegler Exp $
+# $Id: grades.pm,v 1.541 2008/12/22 14:55:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7242,22 +7242,7 @@
     foreach my $resource (@resources) {
         my $symb = $resource->symb();
 
-        my (@parts,@allparts,@possible_parts);
-
-        # Need to retrieve part IDs and response IDs because essayresponse,
-        # reactionresponse and organicresponse items are not included in 
-        # $analysis{'parts'} from lonnet::ssi.  
-        if (ref($resource->parts()) eq 'ARRAY') {
-            foreach my $part (@{$resource->parts()}) {
-                if (!&Apache::loncommon::check_if_partid_hidden($part,$symb,$udom,$uname)) {
-                    my @resp_ids = $resource->responseIds($part);
-                    foreach my $id (@resp_ids) {
-                        my $part_id = $part.'.'.$id;
-                        push(@possible_parts,$part_id);
-                    }
-                }
-            }
-        }
+        my @parts;
 
         my $result=&ssi_with_retries($resource->src(), $ssi_retries,
                                         ('symb' => $symb,
@@ -7278,21 +7263,8 @@
                 }
             }
         }
-        # Add part_ids for any essayresponse, reactionresponse or 
-        # organicresponse items. 
-        foreach my $part_id (@possible_parts) {
-            if (grep(/^\Q$part_id\E$/,@parts)) {
-                push(@allparts,$part_id);
-            } else {
-                if (($analysis{$part_id.'.type'} eq 'essayresponse') ||
-                    ($analysis{$part_id.'.type'} eq 'reactionresponse') ||
-                    ($analysis{$part_id.'.type'} eq 'organicresponse')) {
-                    push(@allparts,$part_id);
-                }
-            }
-        }
 
-	foreach my $part_id (@allparts) {
+	foreach my $part_id (@parts) {
             my $lines;
 
 	    # TODO - make this a persistent hash not an array.