New format for (not_)viewed pages/hits and bandwidth that are now recorded by day (in a dictionnary were only element 0 is initialized). Element 0 is the total. WARNING : not backward compatible with previous databases.
This commit is contained in:
@@ -78,9 +78,9 @@ class IWLADisplayAllVisits(IPlugin):
|
||||
|
||||
row = [
|
||||
address,
|
||||
super_hit['viewed_pages'],
|
||||
super_hit['viewed_hits'],
|
||||
bytesToStr(super_hit['bandwidth']),
|
||||
super_hit['viewed_pages'][0],
|
||||
super_hit['viewed_hits'][0],
|
||||
bytesToStr(super_hit['bandwidth'][0]),
|
||||
time.asctime(super_hit['last_access'])
|
||||
]
|
||||
table.appendRow(row)
|
||||
|
@@ -87,9 +87,9 @@ class IWLADisplayFeeds(IPlugin):
|
||||
if super_hit['feed_parser'] == IWLAPostAnalysisFeeds.MERGED_FEED_PARSER:
|
||||
address += '*'
|
||||
if super_hit['robot']:
|
||||
table.appendRow([address, super_hit['not_viewed_pages'], super_hit['not_viewed_hits']])
|
||||
table.appendRow([address, super_hit['not_viewed_pages'][0], super_hit['not_viewed_hits'][0]])
|
||||
else:
|
||||
table.appendRow([address, super_hit['viewed_pages'], super_hit['viewed_hits']])
|
||||
table.appendRow([address, super_hit['viewed_pages'][0], super_hit['viewed_hits'][0]])
|
||||
page.appendBlock(table)
|
||||
note = DisplayHTMLRaw(self.iwla, ('<small>*%s</small>' % (self.iwla._(u'Merged feeds parsers'))))
|
||||
page.appendBlock(note)
|
||||
|
@@ -68,7 +68,7 @@ class IWLADisplayRobotBandwidth(IPlugin):
|
||||
for (k, super_hit) in hits.items():
|
||||
if not self.iwla.isRobot(super_hit):
|
||||
continue
|
||||
bandwidths.append((super_hit, super_hit['bandwidth']))
|
||||
bandwidths.append((super_hit, super_hit['bandwidth'][0]))
|
||||
bandwidths.sort(key=lambda tup: tup[1], reverse=True)
|
||||
|
||||
# All in a page
|
||||
|
@@ -60,11 +60,11 @@ class IWLADisplayTopVisitors(IPlugin):
|
||||
|
||||
total = [0]*5
|
||||
for super_hit in hits.values():
|
||||
total[1] += super_hit['viewed_pages']
|
||||
total[2] += super_hit['viewed_hits']
|
||||
total[3] += super_hit['bandwidth']
|
||||
total[1] += super_hit['viewed_pages'][0]
|
||||
total[2] += super_hit['viewed_hits'][0]
|
||||
total[3] += super_hit['bandwidth'][0]
|
||||
|
||||
top_bandwidth = [(k,v['bandwidth']) for (k,v) in hits.items()]
|
||||
top_bandwidth = [(k,v['bandwidth'][0]) for (k,v) in hits.items()]
|
||||
top_bandwidth = sorted(top_bandwidth, key=lambda t: t[1], reverse=True)
|
||||
top_visitors = [hits[h[0]] for h in top_bandwidth[:10]]
|
||||
|
||||
@@ -79,14 +79,14 @@ class IWLADisplayTopVisitors(IPlugin):
|
||||
|
||||
row = [
|
||||
address,
|
||||
super_hit['viewed_pages'],
|
||||
super_hit['viewed_hits'],
|
||||
bytesToStr(super_hit['bandwidth']),
|
||||
super_hit['viewed_pages'][0],
|
||||
super_hit['viewed_hits'][0],
|
||||
bytesToStr(super_hit['bandwidth'][0]),
|
||||
time.asctime(super_hit['last_access'])
|
||||
]
|
||||
total[1] -= super_hit['viewed_pages']
|
||||
total[2] -= super_hit['viewed_hits']
|
||||
total[3] -= super_hit['bandwidth']
|
||||
total[1] -= super_hit['viewed_pages'][0]
|
||||
total[2] -= super_hit['viewed_hits'][0]
|
||||
total[3] -= super_hit['bandwidth'][0]
|
||||
table.appendRow(row)
|
||||
if total[1] or total[2] or total[3]:
|
||||
total[0] = self.iwla._(u'Others')
|
||||
|
Reference in New Issue
Block a user