Don't modify traffic dates if there is no traffic history.

This commit is contained in:
Brian Simpson
2014-03-12 03:53:19 -04:00
parent 8738b12414
commit b4baaed6fd

View File

@@ -640,9 +640,10 @@ class PromotedLinkTraffic(Templated):
# 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 history:
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