def unstar(self, nb_hash): stories = StoryModel.scan(StoryModel.nb_hash == nb_hash) story = next(stories) # only expect one result story.starred = False story.update( actions=[ StoryModel.starred.set(False) ] ) statsd.increment('nb.stars_removed')
def list_stories_without_comment_count(self): stories = StoryModel.scan(StoryModel.comments == -1) return stories
def list_urls(self): stories = StoryModel.scan() return list([{'nb_hash': s.nb_hash, 'url': s.url} for s in stories])
def list_stories_with_comments_fewer_than(self, threshold): stories = StoryModel.scan((StoryModel.comments < threshold) & (StoryModel.comments >= 0)) return stories