mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 23:39:11 -05:00
traffic patch for new reddits: removes zero division when there are not yet a week's worth of totals
This commit is contained in:
@@ -1633,8 +1633,10 @@ class RedditTraffic(Traffic):
|
||||
for i, d in enumerate(dates):
|
||||
imp_by_day[d.weekday()].append(float(imps[i]))
|
||||
uni_by_day[d.weekday()].append(float(uniques[i]))
|
||||
self.uniques_by_dow = [sum(x)/len(x) for x in uni_by_day]
|
||||
self.impressions_by_dow = [sum(x)/len(x) for x in imp_by_day]
|
||||
self.uniques_by_dow = [sum(x)/max(len(x),1)
|
||||
for x in uni_by_day]
|
||||
self.impressions_by_dow = [sum(x)/max(len(x),1)
|
||||
for x in imp_by_day]
|
||||
Templated.__init__(self)
|
||||
|
||||
def reddits_summary(self):
|
||||
|
||||
Reference in New Issue
Block a user