Add analysis duration in result
This commit is contained in:
parent
cfe8510970
commit
b1cdb30243
14
iwla.py
14
iwla.py
|
@ -31,7 +31,7 @@ import argparse
|
||||||
import logging
|
import logging
|
||||||
import gettext
|
import gettext
|
||||||
from calendar import monthrange
|
from calendar import monthrange
|
||||||
from datetime import date
|
from datetime import date, datetime
|
||||||
|
|
||||||
import default_conf as conf
|
import default_conf as conf
|
||||||
import conf as _
|
import conf as _
|
||||||
|
@ -136,6 +136,7 @@ class IWLA(object):
|
||||||
self.meta_infos = {}
|
self.meta_infos = {}
|
||||||
self.analyse_started = False
|
self.analyse_started = False
|
||||||
self.current_analysis = {}
|
self.current_analysis = {}
|
||||||
|
self.start_time = 0
|
||||||
self.cache_plugins = {}
|
self.cache_plugins = {}
|
||||||
self.display = DisplayHTMLBuild(self)
|
self.display = DisplayHTMLBuild(self)
|
||||||
self.valid_visitors = None
|
self.valid_visitors = None
|
||||||
|
@ -484,8 +485,15 @@ class IWLA(object):
|
||||||
|
|
||||||
page = self.display.createPage(title, filename, conf.css_path)
|
page = self.display.createPage(title, filename, conf.css_path)
|
||||||
|
|
||||||
last_update = '<b>%s</b> %s<br />' % (self._('Last update'), time.strftime('%02d %b %Y %H:%M', time.localtime()))
|
last_update = u'<b>%s</b> %s<br />' % (self._(u'Last update'), time.strftime('%02d %b %Y %H:%M', time.localtime()))
|
||||||
page.appendBlock(self.display.createBlock(DisplayHTMLRaw, last_update))
|
page.appendBlock(self.display.createBlock(DisplayHTMLRaw, last_update))
|
||||||
|
duration = datetime.now() - self.start_time
|
||||||
|
duration = time.gmtime(duration.seconds)
|
||||||
|
time_analysis = u'<b>%s</b> ' % (self._('Time analysis'))
|
||||||
|
if duration.tm_hour:
|
||||||
|
time_analysis += u'%d %s, ' % (duration.tm_hour, self._(u'hours'))
|
||||||
|
time_analysis += u'%d %s and %d %s<br />' % (duration.tm_min, self._(u'minutes'), duration.tm_sec, self._(u'seconds'))
|
||||||
|
page.appendBlock(self.display.createBlock(DisplayHTMLRaw, time_analysis))
|
||||||
|
|
||||||
for year in sorted(self.meta_infos['stats'].keys(), reverse=True):
|
for year in sorted(self.meta_infos['stats'].keys(), reverse=True):
|
||||||
self._generateDisplayMonthStats(page, year, self.meta_infos['stats'][year])
|
self._generateDisplayMonthStats(page, year, self.meta_infos['stats'][year])
|
||||||
|
@ -654,6 +662,8 @@ class IWLA(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def start(self, _file):
|
def start(self, _file):
|
||||||
|
self.start_time = datetime.now()
|
||||||
|
|
||||||
self.logger.info('==> Load previous database')
|
self.logger.info('==> Load previous database')
|
||||||
|
|
||||||
self.meta_infos = self._deserialize(conf.META_PATH) or self._clearMeta()
|
self.meta_infos = self._deserialize(conf.META_PATH) or self._clearMeta()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user