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

raeburn raeburn@source.lon-capa.org
Mon, 14 Jun 2010 01:30:54 -0000


raeburn		Mon Jun 14 01:30:54 2010 EDT

  Modified files:              
    /loncom/interface/spreadsheet	studentcalc.pm 
  Log:
  - Top level sequence was being included twice.
  
  
Index: loncom/interface/spreadsheet/studentcalc.pm
diff -u loncom/interface/spreadsheet/studentcalc.pm:1.44 loncom/interface/spreadsheet/studentcalc.pm:1.45
--- loncom/interface/spreadsheet/studentcalc.pm:1.44	Tue Jun  9 14:15:42 2009
+++ loncom/interface/spreadsheet/studentcalc.pm	Mon Jun 14 01:30:54 2010
@@ -1,5 +1,5 @@
 #
-# $Id: studentcalc.pm,v 1.44 2009/06/09 14:15:42 bisitz Exp $
+# $Id: studentcalc.pm,v 1.45 2010/06/14 01:30:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -100,11 +100,15 @@
     }
     my @all_sequences = $navmap->retrieveResources(undef,
                                                sub { shift->is_map(); },1,0,1);
-    for my $sequence ($navmap->getById('0.0'), @all_sequences) {
-	if ($navmap->hasResource($sequence,sub { shift->is_problem(); }, 0,1)){
-            push(@Sequences,$sequence);
-	    &get_resources($sequence);
-        }
+    my $toplevelseq = $navmap->getById('0.0');
+    if (!grep(/^\Q$toplevelseq\E$/,@all_sequences)) {
+         unshift(@all_sequences,$toplevelseq);
+    }
+    foreach my $sequence (@all_sequences) {
+       if ($navmap->hasResource($sequence,sub { shift->is_problem(); }, 0,1)){
+           push(@Sequences,$sequence);
+           &get_resources($sequence);
+       }
     }
 }