Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Delete randomized_promotion_list.
Browse files Browse the repository at this point in the history
  • Loading branch information
bsimpson63 committed Mar 7, 2013
1 parent ab31259 commit 94a7ee0
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions r2/r2/lib/promote.py
Expand Up @@ -785,23 +785,6 @@ def make_daily_promotions(offset=0, test=False):
"promotions: %r" % error_campaigns)


def randomized_promotion_list(user, site):
promos = get_promotion_list(user, site)
# no promos, no problem
if not promos:
return []
# more than two: randomize
elif len(promos) > 1:
n = random.uniform(0, 1)
for i, (l, w, cid) in enumerate(promos):
n -= w
if n < 0:
promos = promos[i:] + promos[:i]
break
# fall thru for the length 1 case here as well
return [(l, cid) for l, w, cid in promos]


PromoTuple = namedtuple('PromoTuple', ['link', 'weight', 'campaign'])


Expand Down

0 comments on commit 94a7ee0

Please sign in to comment.