Skip to content

Commit

Permalink
Completed get_current_event_score for user
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie- committed Sep 14, 2017
1 parent fc6cfb4 commit 3bf544a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tracker/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ def get_no_flags(self):

# Get user's score for current event
def get_current_event_score(self):
return 0 #todo
score = db.query_db(
'SELECT SUM(f.value) FROM users u LEFT JOIN flagsfound ff ON ff.user_id = u.id LEFT JOIN flags f ON f.flag = ff.flag_id WHERE f.event_id = ? AND u.id = ?',
(event.get_active().id, self.id),
one=True
)[0]
if score is None:
return 0
return score

def __repr__(self):
return '<User %r>' % self.id
Expand Down

0 comments on commit 3bf544a

Please sign in to comment.