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

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 04 Jun 2004 17:41:36 -0000


matthew		Fri Jun  4 13:41:36 2004 EDT

  Modified files:              
    /loncom/interface	lonstatistics.pm 
  Log:
  &Sequences_with_Assess: Modification to make it possible to use this
  routine without using the &MapSelect selection dialog.  Added parameter
  $mode, which can be 'selected' or 'all'.
  
  
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.101 loncom/interface/lonstatistics.pm:1.102
--- loncom/interface/lonstatistics.pm:1.101	Thu Apr  1 13:49:39 2004
+++ loncom/interface/lonstatistics.pm	Fri Jun  4 13:41:35 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstatistics.pm,v 1.101 2004/04/01 18:49:39 matthew Exp $
+# $Id: lonstatistics.pm,v 1.102 2004/06/04 17:41:35 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -471,13 +471,22 @@
 #######################################################
 #######################################################
 sub Sequences_with_Assess {
+    my ($mode) = @_;
+    $mode = 'selected' if (! defined($mode));
     my @Sequences_to_Show;
-    foreach my $map_symb (@SelectedMaps) {
-        foreach my $sequence (@Sequences) {
-            next if ($sequence->{'symb'} ne $map_symb && $map_symb ne 'all');
-            next if ($sequence->{'num_assess'} < 1);
+    foreach my $sequence (@Sequences) {
+        next if ($sequence->{'num_assess'} < 1);
+        if ($mode eq 'all') {
             push (@Sequences_to_Show,$sequence);
+        } elsif ($mode eq 'selected') {
+            foreach my $map_symb (@SelectedMaps) {
+                if ($sequence->{'symb'} eq $map_symb || $map_symb eq 'all'){
+                    push (@Sequences_to_Show,$sequence);
+                    last; # Only put it in once
+                }
+            }
         }
+
     }
     return @Sequences_to_Show;
 }