mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
PromotedLinkTraffic: better handle campaigns that end early.
This commit is contained in:
@@ -638,6 +638,12 @@ class PromotedLinkTraffic(Templated):
|
||||
"""Shorten range for display and add next/prev buttons."""
|
||||
start, end = promote.get_traffic_dates(thing)
|
||||
|
||||
# Check date of latest traffic (campaigns can end early).
|
||||
history = get_promo_traffic(thing, start, end)
|
||||
end = max(date for date, data in history)
|
||||
end = end.replace(tzinfo=g.tz) # get_promo_traffic returns tz naive
|
||||
# datetimes but is actually g.tz
|
||||
|
||||
if self.period:
|
||||
display_start = self.after
|
||||
display_end = self.before
|
||||
|
||||
Reference in New Issue
Block a user