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

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 19 Jun 2003 13:07:50 -0000


matthew		Thu Jun 19 09:07:50 2003 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm 
  Log:
  Bug 1503 - search now updates the status before contacting servers.
  
  
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.182 loncom/interface/lonsearchcat.pm:1.183
--- loncom/interface/lonsearchcat.pm:1.182	Tue Jun 17 12:01:30 2003
+++ loncom/interface/lonsearchcat.pm	Thu Jun 19 09:07:49 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.182 2003/06/17 16:01:30 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.183 2003/06/19 13:07:49 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1536,7 +1536,9 @@
         $pretty_search_string .= ' '.$pretty_domains_string;
     }
     $pretty_search_string .= "<br />\n";
-    return ('SELECT * FROM metadata WHERE '.$query,$pretty_search_string,
+    my $final_query = 'SELECT * FROM metadata WHERE '.$query;
+#    &Apache::lonnet::logthis($final_query);
+    return ($final_query,$pretty_search_string,
             $libraries_to_query);
 }
 
@@ -2170,22 +2172,23 @@
         if (@Servers_to_contact) {
             # Contact one server
             my $server = shift(@Servers_to_contact);
+            &update_status($r,'contacting '.$server);
             my $reply=&Apache::lonnet::metadata_query($query,$customquery,
                                                       $customshow,[$server]);
             ($server) = keys(%$reply);
             $Server_status{$server} = $reply->{$server};
-            &update_status($r,'contacting '.$server);
         } else {
             # wait a sec. to give time for files to be written
             # This sleep statement is here instead of outside the else 
             # block because we do not want to pause if we have servers
             # left to contact.  
+            if (scalar (keys(%Server_status))) {
+                &update_status($r,
+                               'waiting on '.(join(' ',keys(%Server_status))));
+            }
             sleep(1); 
         }
         #
-        if (scalar (keys(%Server_status))) {
-            &update_status($r,'waiting on '.(join(' ',keys(%Server_status))));
-        }
         #
         # Loop through the servers we have contacted but do not
         # have results from yet, looking for results.