Re: wwwstat-2.0 daily sorting/reporting bug

jem@electriciti.com
Wed, 21 May 1997 12:38:08 -0700 (PDT)


I apologize if this is a known bug.  I went through the most recent set
of hypermail archives.  I did find Stan Hearn's submission on January
2, 1997.  However, I did not find a reply.

If I run wwwstat with $SortDaily = 1, $TopDaily = 10, and $Do_Daily = 2
(I want the top 10 daily records *and* the total set of daily records),
the output will be invalid.

At the beginning of the output_summary subroutine, the daily totals are
sorted to obtain the $earliest and the $latest date.  If I am sorting by
anything other than the primary key value, I will get the dates
corresponding the largest and smallest requests or bytes transferred.

In addition to this error, the sorted dates are stored and never
resorted, which needs to be done for multiple lists (TopN and All).
This results in two lists of daily totals, both exactly the same, since
they are not resorted.

So, in order to fix this, I have the following lines before the
sort occurs:

    my($savedsortdaily) = ($SortDaily);
    $SortDaily = 0;

I reset $SortDaily after I have retrieved the $earliest and $latest
values:

    $SortDaily = $savedsortdaily;

Also, I have modified the output_daily subroutine to loop on the more
appropriate, dynamic result of another sort (which will depend on a
*changed* $SortDaily value:

    foreach $date (sort datecompare keys %DayRequests)

Hopefully, this can go in to some patch or the next release.

JohnM

## John Mendenhall
## jem@electriciti.com
## Senior Network/Systems Administrator