Don't account hits <= last_access (< before)

This commit is contained in:
Gregory Soutade 2014-12-14 15:41:47 +01:00
parent 3c5f117870
commit c221c813bf

10
iwla.py
View File

@ -551,10 +551,9 @@ class IWLA(object):
self.current_analysis = self._deserialize(self.getDBFilename(t)) or self._clearVisits()
self.analyse_started = True
else:
if time.mktime(t) < time.mktime(cur_time):
if time.mktime(t) <= time.mktime(cur_time):
return False
if not self.analyse_started:
self.analyse_started = True
self.analyse_started = True
if cur_time.tm_mon != t.tm_mon:
self._generateMonthStats()
self.current_analysis = self._deserialize(self.getDBFilename(t)) or self._clearVisits()
@ -581,6 +580,8 @@ class IWLA(object):
self.meta_infos = self._deserialize(conf.META_PATH) or self._clearMeta()
if self.meta_infos['last_time']:
print 'Last time'
print self.meta_infos['last_time']
self.current_analysis = self._deserialize(self.getDBFilename(self.meta_infos['last_time'])) or self._clearVisits()
else:
self._clearVisits()
@ -609,8 +610,7 @@ class IWLA(object):
del self.meta_infos['start_analysis_time']
self._serialize(self.meta_infos, conf.META_PATH)
else:
print '==> Analyse not started : nothing to do'
self._generateMonthStats()
print '==> Analyse not started : nothing new'
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Intelligent Web Log Analyzer')