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