From c48b98554f0100583a1201fc0ed7b8a19cc10a4c Mon Sep 17 00:00:00 2001 From: Brian Simpson Date: Fri, 18 Oct 2013 01:33:43 -0400 Subject: [PATCH] PromotionWeights.get_campaigns can filter by sr_name. --- r2/r2/models/bidding.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/r2/r2/models/bidding.py b/r2/r2/models/bidding.py index 8425bedf6..270db68ca 100644 --- a/r2/r2/models/bidding.py +++ b/r2/r2/models/bidding.py @@ -416,7 +416,7 @@ class PromotionWeights(Sessionized, Base): item._delete() @classmethod - def get_campaigns(cls, start, end=None, author_id=None): + def get_campaigns(cls, start, end=None, author_id=None, sr_name=None): start = to_date(start) q = cls.query() if end: @@ -427,7 +427,10 @@ class PromotionWeights(Sessionized, Base): if author_id: q = q.filter(cls.account_id == author_id) - + + if sr_name: + q = q.filter(cls.sr_name == sr_name) + return list(q) @classmethod