[LON-CAPA-cvs] cvs: loncom / lond /lonnet/perl lonnet.pm

raeburn raeburn@source.lon-capa.org
Sun, 16 Aug 2009 21:49:33 -0000


raeburn		Sun Aug 16 21:49:33 2009 EDT

  Modified files:              
    /loncom	lond 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Filtering domain roles search by start and/or end time now actually works.
  - In lond
    - $end, $start reversed.
    -efficiency
        - Check for specific role now occurs first.
        - Move on to check next user as soon as current user fails to satisfy a filter.
  
  
Index: loncom/lond
diff -u loncom/lond:1.420 loncom/lond:1.421
--- loncom/lond:1.420	Mon Aug 10 23:32:26 2009
+++ loncom/lond	Sun Aug 16 21:49:21 2009
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.420 2009/08/10 23:32:26 raeburn Exp $
+# $Id: lond,v 1.421 2009/08/16 21:49:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,7 +59,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.420 $'; #' stupid emacs
+my $VERSION='$Revision: 1.421 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -4559,27 +4559,30 @@
         $rolesfilter=&unescape($rolesfilter);
 	@roles = split(/\&/,$rolesfilter);
     }
-                                                                                           
+
     my $hashref = &tie_domain_hash($udom, "nohist_domainroles", &GDBM_WRCREAT());
     if ($hashref) {
         my $qresult = '';
         while (my ($key,$value) = each(%$hashref)) {
             my $match = 1;
-            my ($start,$end) = split(/:/,&unescape($value));
+            my ($end,$start) = split(/:/,&unescape($value));
             my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,&unescape($key));
-            unless ($startfilter eq '.' || !defined($startfilter)) {
-                if ((defined($start)) && ($start >= $startfilter)) {
+            unless (@roles < 1) {
+                unless (grep/^\Q$trole\E$/,@roles) {
                     $match = 0;
+                    next;
                 }
             }
-            unless ($endfilter eq '.' || !defined($endfilter)) {
-                if ((defined($end)) && ($end <= $endfilter)) {
+            unless ($startfilter eq '.' || !defined($startfilter)) {
+                if ((defined($start)) && ($start >= $startfilter)) {
                     $match = 0;
+                    next;
                 }
             }
-            unless (@roles < 1) {
-                unless (grep/^\Q$trole\E$/,@roles) {
+            unless ($endfilter eq '.' || !defined($endfilter)) {
+                if ((defined($end)) && (($end > 0) && ($end <= $endfilter))) {
                     $match = 0;
+                    next;
                 }
             }
             if ($match == 1) {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1017 loncom/lonnet/perl/lonnet.pm:1.1018
--- loncom/lonnet/perl/lonnet.pm:1.1017	Sat Aug 15 00:25:53 2009
+++ loncom/lonnet/perl/lonnet.pm	Sun Aug 16 21:49:32 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1017 2009/08/15 00:25:53 raeburn Exp $
+# $Id: lonnet.pm,v 1.1018 2009/08/16 21:49:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3146,10 +3146,10 @@
 
 sub get_domain_roles {
     my ($dom,$roles,$startdate,$enddate)=@_;
-    if (undef($startdate) || $startdate eq '') {
+    if ((!defined($startdate)) || ($startdate eq '')) {
         $startdate = '.';
     }
-    if (undef($enddate) || $enddate eq '') {
+    if ((!defined($enddate)) || ($enddate eq '')) {
         $enddate = '.';
     }
     my $rolelist;