diff --git a/r2/r2/models/promo.py b/r2/r2/models/promo.py index 4ece23f12..ee5e80da2 100644 --- a/r2/r2/models/promo.py +++ b/r2/r2/models/promo.py @@ -199,6 +199,19 @@ class LiveAdWeights(object): results[''] = results.pop(cls.FRONT_PAGE) return results + @classmethod + def get_live_subreddits(cls): + q = cls._cf.get_range() + results = [] + empty = {cls.column: '[]'} + for sr_id, columns in q: + if sr_id in (cls.ALL_ADS, cls.FRONT_PAGE): + continue + if not columns or columns == empty: + continue + results.append(int(sr_id)) + return results + @classmethod def set_all_from_weights(cls, all_weights): """Given a dictionary with all ads that should currently be running