From 6f1028e6b3ae7ecc707db7483c2390863c6ca88f Mon Sep 17 00:00:00 2001 From: Keith Mitchell Date: Mon, 1 Apr 2013 14:55:45 -0700 Subject: [PATCH] Skip over Ads with 0 weight --- r2/r2/lib/promote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r2/r2/lib/promote.py b/r2/r2/lib/promote.py index ad803ba07..4e510314f 100644 --- a/r2/r2/lib/promote.py +++ b/r2/r2/lib/promote.py @@ -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)