Save month stats in meta dictionary
This commit is contained in:
parent
81c3aa8099
commit
5d6362105b
|
@ -9,7 +9,7 @@ HOOKS_ROOT = 'plugins'
|
|||
PRE_HOOK_DIRECTORY = HOOKS_ROOT + '.pre_analysis'
|
||||
POST_HOOK_DIRECTORY = HOOKS_ROOT + '.post_analysis'
|
||||
DISPLAY_HOOK_DIRECTORY = HOOKS_ROOT + '.display'
|
||||
META_PATH = DB_ROOT + 'meta.db'
|
||||
META_PATH = os.path.join(DB_ROOT, 'meta.db')
|
||||
DB_FILENAME = 'iwla.db'
|
||||
|
||||
log_format = '$server_name:$server_port $remote_addr - $remote_user [$time_local] ' +\
|
||||
|
|
12
iwla.py
12
iwla.py
|
@ -114,7 +114,7 @@ class IWLA(object):
|
|||
os.makedirs(base)
|
||||
|
||||
# TODO : remove return
|
||||
return
|
||||
#return
|
||||
|
||||
with open(filename + '.tmp', 'wb+') as f:
|
||||
pickle.dump(obj, f)
|
||||
|
@ -317,6 +317,7 @@ class IWLA(object):
|
|||
visits = self.current_analysis['visits']
|
||||
|
||||
stats = self._generateStats(visits)
|
||||
duplicated_stats = {k:v for (k,v) in stats.items()}
|
||||
|
||||
cur_time = self.meta_infos['last_time']
|
||||
print "== Stats for %d/%d ==" % (cur_time.tm_year, cur_time.tm_mon)
|
||||
|
@ -344,6 +345,15 @@ class IWLA(object):
|
|||
|
||||
self._generateDisplay()
|
||||
|
||||
# Save month stats
|
||||
year = '%d' % (cur_time.tm_year)
|
||||
month = '%d' % (cur_time.tm_mon)
|
||||
if not 'stats' in self.meta_infos.keys():
|
||||
self.meta_infos['stats'] = {}
|
||||
if not year in self.meta_infos['stats'].keys():
|
||||
self.meta_infos['stats'][year] = {}
|
||||
self.meta_infos['stats'][year][month] = duplicated_stats
|
||||
|
||||
def _generateDayStats(self):
|
||||
visits = self.current_analysis['visits']
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user