[LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Mon, 19 Apr 2004 17:40:01 -0000
matthew Mon Apr 19 13:40:01 2004 EDT
Modified files:
/loncom/interface lonsearchcat.pm
Log:
Bug 2910: negative time remaining in search. Fixed by setting
time_remaining to 0 when it is less than zero. Increased the frequency of
time updates (appears to work more consistently now) by updating the time
both before and after we undertake very time consuming tasks (instead of
just after).
Also checked for untitled documents since the document title is used for
linking most of the time.
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.209 loncom/interface/lonsearchcat.pm:1.210
--- loncom/interface/lonsearchcat.pm:1.209 Mon Apr 19 12:53:27 2004
+++ loncom/interface/lonsearchcat.pm Mon Apr 19 13:40:00 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.209 2004/04/19 16:53:27 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.210 2004/04/19 17:40:00 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1918,11 +1918,13 @@
END
$r->rflush();
my $time_remaining = $max_time - (time - $starttime) ;
+ $time_remaining = 0 if ($time_remaining <0);
my $last_time = $time_remaining;
&update_seconds($r,$time_remaining);
&update_status($r,'contacting '.$Servers_to_contact[0]);
while (($time_remaining > 0) &&
((@Servers_to_contact) || keys(%Server_status))) {
+ &update_seconds($r,$time_remaining);
# Send out a search request if it needs to be done.
if (@Servers_to_contact) {
# Contact one server
@@ -1948,6 +1950,12 @@
# have results from yet, looking for results.
while (my ($server,$status) = each(%Server_status)) {
last if ($connection->aborted());
+ $time_remaining = $max_time - (time - $starttime) ;
+ $time_remaining = 0 if ($time_remaining < 0);
+ if ($last_time - $time_remaining > 0) {
+ $last_time = $time_remaining;
+ &update_seconds($r,$time_remaining);
+ }
if ($status eq 'con_lost') {
delete ($Server_status{$server});
next;
@@ -1990,6 +1998,7 @@
# $r->print(&Apache::lonmysql::get_debug());
$hitcountsum ++;
$time_remaining = $max_time - (time - $starttime) ;
+ $time_remaining = 0 if ($time_remaining < 0);
if ($last_time - $time_remaining > 0) {
&update_seconds($r,$time_remaining);
$last_time = $time_remaining;
@@ -2185,6 +2194,9 @@
}
my %Fields = %{&parse_row(@$row)};
my $output="<p>\n";
+ if (! defined($Fields{'title'}) || $Fields{'title'} eq '') {
+ $Fields{'title'} = 'Untitled';
+ }
my $prefix=&catalogmode_output($Fields{'title'},$Fields{'url'},
$Fields{'id'},$checkbox_num++);
# Render the result into html