Seems ok for account

This commit is contained in:
Gregory Soutade 2014-12-14 14:50:30 +01:00
parent bb7ce4af90
commit 9da4eb3858

40
iwla.py
View File

@ -255,12 +255,8 @@ class IWLA(object):
hit['is_page'] = self.isPage(uri)
status = int(hit['status'])
if status not in conf.viewed_http_codes:
return
if super_hit['robot'] or\
not status in conf.viewed_http_codes:
not int(hit['status']) in conf.viewed_http_codes:
page_key = 'not_viewed_pages'
hit_key = 'not_viewed_hits'
else:
@ -520,30 +516,28 @@ class IWLA(object):
stats = self._createEmptyStats()
for (k, super_hit) in visits.items():
if super_hit['robot']:
stats['not_viewed_bandwidth'] += super_hit['bandwidth']
if super_hit['last_access'].tm_mday != cur_time.tm_mday:
continue
viewed_page = False
for hit in super_hit['requests'][::-1]:
if hit['time_decoded'].tm_mday != cur_time.tm_mday:
break
if super_hit['robot'] or\
not int(hit['status']) in conf.viewed_http_codes:
stats['not_viewed_bandwidth'] += int(hit['body_bytes_sent'])
continue
stats['viewed_bandwidth'] += int(hit['body_bytes_sent'])
if hit['is_page']:
stats['viewed_pages'] += 1
viewed_pages = True
else:
stats['viewed_hits'] += 1
if (conf.count_hit_only_visitors or\
super_hit['viewed_pages']) and\
super_hit['last_access'].tm_mday == cur_time.tm_mday:
viewed_pages):
stats['nb_visitors'] += 1
stats['viewed_bandwidth'] += super_hit['bandwidth']
stats['viewed_pages'] += super_hit['viewed_pages']
stats['viewed_hits'] += super_hit['viewed_hits']
print "== Stats for %d/%02d/%d ==" % (cur_time.tm_year, cur_time.tm_mon, cur_time.tm_mday)
if cur_time.tm_mday > 1:
last_day = cur_time.tm_mday - 1
while last_day:
if last_day in self.current_analysis['days_stats'].keys():
break
last_day -= 1
if last_day:
for k in stats.keys():
if k != 'nb_visitors':
print '%s : %d %d' % (k, stats[k], self.current_analysis['days_stats'][last_day][k])
stats[k] -= self.current_analysis['days_stats'][last_day][k]
print stats
self.current_analysis['days_stats'][cur_time.tm_mday] = stats