[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Thu, 24 Apr 2003 18:18:38 -0000


bowersj2		Thu Apr 24 14:18:38 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Kludge around the problem in charts with parts showing up multiple times.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.180 loncom/interface/lonnavmaps.pm:1.181
--- loncom/interface/lonnavmaps.pm:1.180	Tue Apr 22 14:42:47 2003
+++ loncom/interface/lonnavmaps.pm	Thu Apr 24 14:18:38 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.180 2003/04/22 18:42:47 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.181 2003/04/24 18:18:38 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3078,6 +3078,8 @@
 
     $self->{PARTS} = [];
 
+    my %parts;
+
     # Retrieve part count, if this is a problem
     if ($self->is_problem()) {
         my $metadata = &Apache::lonnet::metadata($self->src(), 'packages');
@@ -3089,15 +3091,21 @@
         foreach (split(/\,/,$metadata)) {
             if ($_ =~ /^part_(.*)$/) {
                 my $part = $1;
+                # This floods the logs
+                #if (defined($parts{$part})) {
+                #    Apache::lonnet::logthis("$part multiply defined in metadata for " . $self->symb());
+                #  }
+
                 # check to see if part is turned off.
-                if (! Apache::loncommon::check_if_partid_hidden($part, $self->symb())) {
-                    push @{$self->{PARTS}}, $1;
+
+                if (!Apache::loncommon::check_if_partid_hidden($part, $self->symb())) {
+                    $parts{$part} = 1;
                 }
             }
         }
         
         
-        my @sortedParts = sort @{$self->{PARTS}};
+        my @sortedParts = sort keys %parts;
         $self->{PARTS} = \@sortedParts;
     }