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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Wed, 14 May 2003 18:34:44 -0000


bowersj2		Wed May 14 14:34:44 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  This will be more reliable, so things with no part id still have empty
  lists instead of undef.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.188 loncom/interface/lonnavmaps.pm:1.189
--- loncom/interface/lonnavmaps.pm:1.188	Wed May 14 14:33:28 2003
+++ loncom/interface/lonnavmaps.pm	Wed May 14 14:34:44 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.188 2003/05/14 18:33:28 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.189 2003/05/14 18:34:44 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3201,6 +3201,12 @@
         my %responseIdHash;
         my %responseTypeHash;
 
+
+        # Init the responseIdHash
+        foreach (@{$self->{PARTS}}) {
+            $responseIdHash{$_} = [];
+        }
+
         # Now, the unfortunate thing about this is that parts, part name, and
         # response if are delimited by underscores, but both the part
         # name and response id can themselves have underscores in them.
@@ -3221,9 +3227,6 @@
                     if ($parts{$partIdSoFar}) {
                         my @otherChunks = @partChunks[$i+1..$#partChunks];
                         my $responseId = join('_', @otherChunks);
-                        if (!defined($responseIdHash{$partIdSoFar})) {
-                            $responseIdHash{$partIdSoFar} = [];
-                        }
                         push @{$responseIdHash{$partIdSoFar}}, $responseId;
                         $responseTypeHash{$partIdSoFar} = $responseType;
                         last;