class DisplayHTMLBlockTableWithGraph() seems to work

Fix a bug : month_stats override if iwla.py called twice
This commit is contained in:
2014-12-02 20:49:56 +01:00
parent 63a9b40b46
commit 7d45b45e8a
4 changed files with 36 additions and 12 deletions

16
iwla.py
View File

@@ -245,19 +245,21 @@ class IWLA(object):
days.setColsCSSClass(['', 'iwla_visit', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', 'iwla_bandwidth'])
nb_visits = 0
nb_days = 0
for i in range(0, nb_month_days+1):
for i in range(0, nb_month_days):
cur_day = '%d %s' % (i+1, time.strftime('%b', cur_time))
full_cur_day = '%s %d' % (cur_day, cur_time.tm_year)
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'],
row = [full_cur_day, stats['nb_visitors'], stats['viewed_pages'], stats['viewed_hits'],
stats['viewed_bandwidth'], stats['not_viewed_bandwidth']]
nb_visits += stats['nb_visitors']
nb_days += 1
else:
row = [i, 0, 0, 0, 0, 0]
row = [full_cur_day, 0, 0, 0, 0, 0]
days.appendRow(row)
days.setCellValue(i, 4, bytesToStr(row[4]))
days.setCellValue(i, 5, bytesToStr(row[5]))
days.appendShortTitle(str(i))
days.appendShortTitle(cur_day)
stats = self.current_analysis['month_stats']
@@ -326,7 +328,11 @@ class IWLA(object):
print "== Stats for %d/%d ==" % (cur_time.tm_year, cur_time.tm_mon)
print stats
self.current_analysis['month_stats'] = stats
if not 'month_stats' in self.current_analysis.keys():
self.current_analysis['month_stats'] = stats
else:
for (k,v) in stats.items():
self.current_analysis['month_stats'][k] = v
self.valid_visitors = {}
for (k,v) in visits.items():