stream settings: Fix brand new streams showing 0 weekly traffic.

A stream created in the last few hours likely won't be in StreamCount
(since that gets updated once a day), and hence won't be in the
recent_traffic dict.

However, get_average_weekly_stream_traffic should be None in this case,
not 0.
This commit is contained in:
Rishi Gupta
2018-07-23 15:32:52 -07:00
committed by Tim Abbott
parent 0573c17819
commit e37b5dce79

View File

@@ -3969,7 +3969,7 @@ def get_average_weekly_stream_traffic(stream_id: int, stream_date_created: datet
try:
stream_traffic = recent_traffic[stream_id]
except KeyError:
return 0
stream_traffic = 0
stream_age = (timezone_now() - stream_date_created).days