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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 17 Mar 2008 20:39:51 -0000


raeburn		Mon Mar 17 16:39:51 2008 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Bug 5655.
  - exclude hidden parts. 
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.514 loncom/homework/grades.pm:1.515
--- loncom/homework/grades.pm:1.514	Tue Mar 11 22:46:52 2008
+++ loncom/homework/grades.pm	Mon Mar 17 16:39:50 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.514 2008/03/12 02:46:52 raeburn Exp $
+# $Id: grades.pm,v 1.515 2008/03/17 20:39:50 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7231,20 +7231,23 @@
     my $response_number = 0;
     my $bubble_line     = 0;
     foreach my $resource (@resources) {
+        my $symb = $resource->symb();
         # Need to retrieve part IDs and response IDs because essayresponse,
         # reactionresponse and organicresponse items are not included in 
         # $analysis{'parts'} from lonnet::ssi.  
         my %possible_part_ids; 
         if (ref($resource->parts()) eq 'ARRAY') { 
             foreach my $part (@{$resource->parts()}) {
-                my @resp_ids = $resource->responseIds($part);
-                foreach my $id (@resp_ids) {
-                    $possible_part_ids{$part.'.'.$id} = 1;
+                if (!&Apache::loncommon::check_if_partid_hidden($part,$symb,$udom,$uname)) {
+                    my @resp_ids = $resource->responseIds($part);
+                    foreach my $id (@resp_ids) {
+                        $possible_part_ids{$part.'.'.$id} = 1;
+                    }
                 }
             }
         }
 	my $result=&ssi_with_retries($resource->src(), $ssi_retries,
-					('symb' => $resource->symb()),
+					('symb' => $symb),
 					('grade_target' => 'analyze'),
 					('grade_courseid' => $cid),
 					('grade_domain' => $udom),
@@ -7257,7 +7260,12 @@
 	my %analysis = &Apache::lonnet::str2hash($an);
 
         if (ref($analysis{'parts'}) eq 'ARRAY') {
-            @parts = @{$analysis{'parts'}};
+            foreach my $part (@{$analysis{'parts'}}) {
+                my ($id,$respid) = split(/\./,$part);
+                if (!&Apache::loncommon::check_if_partid_hidden($id,$symb,$udom,$uname)) {
+                    push(@parts,$part);
+                }
+            }
         }
         # Add part_ids for any essayresponse items. 
         foreach my $part_id (keys(%possible_part_ids)) {