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

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 16 Mar 2006 21:53:17 -0000


raeburn		Thu Mar 16 16:53:17 2006 EDT

  Modified files:              
    /loncom/interface	lonpickstudent.pm 
  Log:
  Efficiency, sort groups (not hash order).
  
  
Index: loncom/interface/lonpickstudent.pm
diff -u loncom/interface/lonpickstudent.pm:1.13 loncom/interface/lonpickstudent.pm:1.14
--- loncom/interface/lonpickstudent.pm:1.13	Thu Mar 16 16:34:04 2006
+++ loncom/interface/lonpickstudent.pm	Thu Mar 16 16:53:17 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a student from the classlist
 #
-# $Id: lonpickstudent.pm,v 1.13 2006/03/16 21:34:04 albertel Exp $
+# $Id: lonpickstudent.pm,v 1.14 2006/03/16 21:53:17 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -77,10 +77,7 @@
     my %grouplist=&Apache::lonnet::get_group_membership($cdom,$cnum);
     my $now = time;
     my %allgroups;
-    my @coursegroups = ();
-    if (&Apache::loncommon::coursegroups(\%allgroups,$cdom,$cnum)) {
-        @coursegroups = keys(%allgroups);
-    }
+    &Apache::loncommon::coursegroups(\%allgroups,$cdom,$cnum);
 
 # --------------------------------------- There is such a user, get environment
 
@@ -135,7 +132,7 @@
 	    if (($uname=~/^$filter/) || 
                 ($fullname=~/^$filter/i)) {
                my $grouplist = '';
-               foreach my $group (@coursegroups) {
+               foreach my $group (sort(keys(%allgroups))) {
                    if (exists($grouplist{$group.':'.$uname.':'.$udom})) {
                        my ($end,$start) = split(/:/,$grouplist{$group.':'.$uname.':'.$udom});
                        if (($end!=0) && ($end<$now)) { next; }