From 2c3d8d22f8b37465f2a5565be93577647ec3df25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Fri, 12 Dec 2014 13:18:12 +0100 Subject: [PATCH] Always checks time before append hit --- iwla.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/iwla.py b/iwla.py index c41f06b..0f49362 100755 --- a/iwla.py +++ b/iwla.py @@ -194,7 +194,7 @@ class IWLA(object): return self.display def getDBFilename(self, time): - return os.path.join(conf.DB_ROOT, str(time.tm_year), str(time.tm_mon), conf.DB_FILENAME) + return os.path.join(conf.DB_ROOT, str(time.tm_year), '%02d' % time.tm_mon, conf.DB_FILENAME) def _serialize(self, obj, filename): base = os.path.dirname(filename) @@ -514,7 +514,6 @@ class IWLA(object): os.remove(path) print "==> Serialize to %s" % path - self._serialize(self.current_analysis, path) # Save month stats @@ -568,11 +567,10 @@ 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): + return False if not self.analyse_started: - if time.mktime(t) < time.mktime(cur_time): - return False - else: - 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()