mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 00:07:57 -05:00
Add get_live_subreddits method for LiveAdWeights.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user