Skip to content

Commit

Permalink
Provide an __int__ for ScoreClause
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrobenolt committed Mar 14, 2014
1 parent cf64c9d commit f6ed2eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/sentry/manager.py
Expand Up @@ -63,6 +63,11 @@ class ScoreClause(object):
def __init__(self, group):
self.group = group

def __int__(self):
# Calculate the score manually when coercing to an int.
# This is used within create_or_update and friends
return self.group.get_score()

def prepare_database_save(self, unused):
return self

Expand All @@ -77,7 +82,7 @@ def evaluate(self, node, qn, connection):
sql = 'log(times_seen) * 600 + unix_timestamp(last_seen)'
else:
# XXX: if we cant do it atomically let's do it the best we can
sql = self.group.get_score()
sql = int(self)

return (sql, [])

Expand Down

0 comments on commit f6ed2eb

Please sign in to comment.