better scoreboard

master
Marek Baczynski 6 years ago
parent a24d793287
commit 566d03096a

@ -28,7 +28,7 @@ def connect(user, password, db, host='localhost', port=5432):
return con, meta return con, meta
def getLeaderboard(): def getLeaderboard():
s = 'select u.username as name, u.score as score, max(m.meal_date) as last_meal from users as u inner join meals as m on u.id = m.kuk where m.kuk>0 and m.status>0 group by u.id order by u.score, last_meal;' s = 'select u.username as name, u.score as score, max(m.meal_date) as last_meal from users as u left join meals as m on m.kuk = u.id group by u.id order by score, last_meal;'
r = db_engine.execute(text(s)) r = db_engine.execute(text(s))
leaders=[] leaders=[]
for row in r: for row in r:

Loading…
Cancel
Save