Display empty stats
This commit is contained in:
parent
1b4f9c0ad5
commit
d4170ad3ed
20
iwla.py
20
iwla.py
|
@ -6,6 +6,7 @@ import time
|
|||
import pickle
|
||||
import gzip
|
||||
import importlib
|
||||
from calendar import monthrange
|
||||
|
||||
import default_conf as conf
|
||||
import conf as _
|
||||
|
@ -235,19 +236,22 @@ class IWLA(object):
|
|||
|
||||
days = DisplayHTMLBlockTable('By day', ['Day', 'Visits', 'Pages', 'Hits', 'Bandwidth', 'Not viewed Bandwidth'])
|
||||
days.setColsCSSClass(['', 'iwla_visit', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', 'iwla_bandwidth'])
|
||||
keys = self.current_analysis['days_stats'].keys()
|
||||
keys.sort()
|
||||
nb_visits = 0
|
||||
for k in keys:
|
||||
stats = self.current_analysis['days_stats'][k]
|
||||
row = [k, stats['nb_visitors'], stats['viewed_pages'], stats['viewed_hits'],
|
||||
bytesToStr(stats['viewed_bandwidth']), bytesToStr(stats['not_viewed_bandwidth'])]
|
||||
nb_days = 0
|
||||
_, nb_month_days = monthrange(cur_time.tm_year, cur_time.tm_mon)
|
||||
for i in range(0, nb_month_days+1):
|
||||
if i in self.current_analysis['days_stats'].keys():
|
||||
stats = self.current_analysis['days_stats'][i]
|
||||
row = [i, stats['nb_visitors'], stats['viewed_pages'], stats['viewed_hits'],
|
||||
bytesToStr(stats['viewed_bandwidth']), bytesToStr(stats['not_viewed_bandwidth'])]
|
||||
nb_visits += stats['nb_visitors']
|
||||
nb_days += 1
|
||||
else:
|
||||
row = [i, '', '', '', '', '']
|
||||
days.appendRow(row)
|
||||
nb_visits += stats['nb_visitors']
|
||||
|
||||
stats = self.current_analysis['month_stats']
|
||||
|
||||
nb_days = len(keys)
|
||||
row = [0, nb_visits, stats['viewed_pages'], stats['viewed_hits'], stats['viewed_bandwidth'], stats['not_viewed_bandwidth']]
|
||||
if nb_days:
|
||||
average_row = map(lambda(v): int(v/nb_days), row)
|
||||
|
|
Loading…
Reference in New Issue
Block a user