mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-02-06 04:35:12 -05:00
Skip over Ads with 0 weight
This commit is contained in:
committed by
Max Goodman
parent
79ccaca4ea
commit
6f1028e6b3
@@ -824,7 +824,7 @@ def get_promotion_list_cached(sites):
|
||||
def lottery_promoted_links(user, site, n=10):
|
||||
"""Run weighted_lottery to order and choose a subset of promoted links."""
|
||||
promo_tuples = get_promotion_list(user, site)
|
||||
weights = {p: p.weight for p in promo_tuples}
|
||||
weights = {p: p.weight for p in promo_tuples if p.weight}
|
||||
selected = []
|
||||
while weights and len(selected) < n:
|
||||
s = weighted_lottery(weights)
|
||||
|
||||
Reference in New Issue
Block a user