changeset 3469:94a6f5fbf8b7

stats.hitcounts: fixes multiple call of Hits (MoinMoinBugs/ClickOnNavibarIncreasesHitsByMultiplicator)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Fri, 04 Apr 2008 23:48:41 +0200
parents ab35449c4708
children e69146342ed8
files MoinMoin/logfile/__init__.py MoinMoin/stats/hitcounts.py
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/logfile/__init__.py	Fri Apr 04 23:11:07 2008 +0200
+++ b/MoinMoin/logfile/__init__.py	Fri Apr 04 23:48:41 2008 +0200
@@ -204,6 +204,7 @@
             raise
 
     def date(self):
+        # ToDo check if we need this method
         """ Return timestamp of log file in usecs """
         try:
             mtime = os.path.getmtime(self.__filename)
--- a/MoinMoin/stats/hitcounts.py	Fri Apr 04 23:11:07 2008 +0200
+++ b/MoinMoin/stats/hitcounts.py	Fri Apr 04 23:48:41 2008 +0200
@@ -84,7 +84,11 @@
     ratchet_time = None
     if new_date is not None:
         log.set_filter(['VIEWPAGE', 'SAVEPAGE'])
+        latest = None
         for event in log.reverse():
+            # don't use event_log.date()
+            if latest is None:
+                latest = event[0]
             event_usecs = event[0]
             if event_usecs <= cache_date:
                 break
@@ -129,7 +133,7 @@
     cache_views.extend(views)
     cache_edits.extend(edits)
     if new_date is not None:
-        cache.update((new_date, cache_days, cache_views, cache_edits))
+        cache.update((latest, cache_days, cache_views, cache_edits))
 
     return cache_days, cache_views, cache_edits