Example #1
0
 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')
Example #2
0
 def list_stories_without_comment_count(self):
     stories = StoryModel.scan(StoryModel.comments == -1)
     return stories
Example #3
0
 def list_urls(self):
     stories = StoryModel.scan()
     return list([{'nb_hash': s.nb_hash, 'url': s.url} for s in stories])
Example #4
0
 def list_stories_with_comments_fewer_than(self, threshold):
     stories = StoryModel.scan((StoryModel.comments < threshold) & (StoryModel.comments >= 0))
     return stories