mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-24 06:18:08 -05:00
Check for valid campaign when fetching bid history
Occasional rogue promotion weights were causing /promoted/graph to fail. We should figure out how those weights are being created in the first place, but for now just check to make sure a campaign exists before using it.
This commit is contained in:
@@ -565,7 +565,11 @@ class PromotionWeights(Sessionized, Base):
|
||||
for i in q:
|
||||
if d == i.date:
|
||||
l = links[i.thing_name]
|
||||
if not promote.is_rejected(l) and not promote.is_unpaid(l) and not l._deleted:
|
||||
if (not promote.is_rejected(l) and
|
||||
not promote.is_unpaid(l) and
|
||||
not l._deleted and
|
||||
i.promo_idx in getattr(l, 'campaigns', {})):
|
||||
|
||||
camp = l.campaigns[i.promo_idx]
|
||||
bid += i.bid
|
||||
refund += i.bid if camp[-1] <= 0 else 0
|
||||
|
||||
Reference in New Issue
Block a user