[phpOpenTracker-devel] Bug in "returning_visitors" plugin ? (_numReturningVisitors)

Hannes Mayer <[email protected]> Thu, 13 Oct 2005 14:47:17 +0200
Newsgroups gmane.comp.web.phpopentracker.devel
Message-ID <[email protected]>
Hi all!

I was investigating the problem with _numOneTimeVisitors, why there
are negative numbers appearing.

_numOneTimeVisitors returns num_unique_visitors - num_returning_visitors.
Since num_returning_visitors is bigger than num_unique_visitors, the
outcome for the one-time-visitors is negative.

I guess the culprit is in API/plugins/returning_visitors.php:
_numReturningVisitors:
 "SELECT COUNT(visitors.visitor_id) AS returning_visitors
while I think it should be:
 "SELECT COUNT(DISTINCT(visitors.visitor_id)) AS returning_visitors

If there is no DISTINCT, one returning visitor might be counted twice or more.
At least I think that's the solution, since the computed numbers seem
to match after the change.

I'd be glad if anyone of the core developers could have a look into this.
I use phpOpenTracker-1.5.2.

Thanks a lot for any replies and the cool project,
Hannes.