diff --git a/src/sentry/manager.py b/src/sentry/manager.py index 4ad24e2ec02a7..cd553a9d2002a 100644 --- a/src/sentry/manager.py +++ b/src/sentry/manager.py @@ -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 @@ -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, [])