Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CampaignBuilder don't combine campaigns on same link.

  • Loading branch information...
commit d8c9db9af89b10bbf471f498a7988b90ab048cd7 1 parent f61587c
@bsimpson63 bsimpson63 authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 r2/r2/models/builder.py
View
7 r2/r2/models/builder.py
@@ -43,6 +43,7 @@
from r2.models.wiki import WIKI_RECENT_DAYS
+from collections import defaultdict
import time
from admintools import compute_votes, admintools, ip_span
@@ -511,11 +512,13 @@ def thing_lookup(self, tuples):
def wrap_items(self, items):
links = [i.thing for i in items]
wrapped = IDBuilder.wrap_items(self, links)
- by_link = {w._fullname: w for w in wrapped}
+ by_link = defaultdict(list)
+ for w in wrapped:
+ by_link[w._fullname].append(w)
ret = []
for i in items:
- w = by_link[i.thing._fullname]
+ w = by_link[i.thing._fullname].pop()
w.campaign = i.campaign
w.weight = i.weight
ret.append(w)
Please sign in to comment.
Something went wrong with that request. Please try again.