iwla

iwla Commit Details

Date:2014-11-28 16:26:11 (6 years 8 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:d4170ad3ed47751d75904b4aee0bfa38adfa5b2d
Parents: 1b4f9c0ad590199ba1486a1f7138f3b5b7488015
Message:Display empty stats

Changes:
Miwla.py (2 diffs)

File differences

iwla.py
66
77
88
9
910
1011
1112
......
235236
236237
237238
238
239
240239
241
242
243
244
240
241
242
243
244
245
246
247
248
249
250
245251
246
247252
248253
249254
250
251255
252256
253257
import pickle
import gzip
import importlib
from calendar import monthrange
import default_conf as conf
import conf as _
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)

Archive Download the corresponding diff file

Branches

Tags