Skip to content

Commit

Permalink
Correctly deal with counting paginated results from datanommer.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Aug 3, 2013
1 parent cfd77ad commit f3df5c9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fedbadges/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,13 @@ def construct_query(self, msg):
kwargs = recursive_lambda_factory(kwargs, msg, name='msg')
kwargs['defer'] = True
total, pages, query = datanommer.models.Message.grep(**kwargs)
return query
return total, pages, query

def matches(self, msg):
query = self.construct_query(msg)
operation = getattr(query, self._d['operation'])
result = operation()
total, pages, query = self.construct_query(msg)
if self._d['operation'] == 'count':
result = total
else:
operation = getattr(query, self._d['operation'])
result = operation()
return self.condition(result)

0 comments on commit f3df5c9

Please sign in to comment.