Always checks time before append hit
This commit is contained in:
parent
15d2877e5a
commit
2c3d8d22f8
10
iwla.py
10
iwla.py
|
@ -194,7 +194,7 @@ class IWLA(object):
|
||||||
return self.display
|
return self.display
|
||||||
|
|
||||||
def getDBFilename(self, time):
|
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):
|
def _serialize(self, obj, filename):
|
||||||
base = os.path.dirname(filename)
|
base = os.path.dirname(filename)
|
||||||
|
@ -514,7 +514,6 @@ class IWLA(object):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
|
||||||
print "==> Serialize to %s" % path
|
print "==> Serialize to %s" % path
|
||||||
|
|
||||||
self._serialize(self.current_analysis, path)
|
self._serialize(self.current_analysis, path)
|
||||||
|
|
||||||
# Save month stats
|
# Save month stats
|
||||||
|
@ -568,11 +567,10 @@ class IWLA(object):
|
||||||
self.current_analysis = self._deserialize(self.getDBFilename(t)) or self._clearVisits()
|
self.current_analysis = self._deserialize(self.getDBFilename(t)) or self._clearVisits()
|
||||||
self.analyse_started = True
|
self.analyse_started = True
|
||||||
else:
|
else:
|
||||||
|
if time.mktime(t) < time.mktime(cur_time):
|
||||||
|
return False
|
||||||
if not self.analyse_started:
|
if not self.analyse_started:
|
||||||
if time.mktime(t) < time.mktime(cur_time):
|
self.analyse_started = True
|
||||||
return False
|
|
||||||
else:
|
|
||||||
self.analyse_started = True
|
|
||||||
if cur_time.tm_mon != t.tm_mon:
|
if cur_time.tm_mon != t.tm_mon:
|
||||||
self._generateMonthStats()
|
self._generateMonthStats()
|
||||||
self.current_analysis = self._deserialize(self.getDBFilename(t)) or self._clearVisits()
|
self.current_analysis = self._deserialize(self.getDBFilename(t)) or self._clearVisits()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user