git.fiddlerwoaroof.com
Browse code

Sort and limit active users

fiddlerwoaroof authored on 19/10/2015 23:07:22
Showing 1 changed files
... ...
@@ -127,7 +127,7 @@ def active():
127 127
     result = dict(status=False, data=[])
128 128
     with database.get_db() as db:
129 129
         with db.cursor() as cur:
130
-            cur.execute("SELECT * FROM recently_active_users")
130
+            cur.execute("SELECT * FROM recently_active_users ORDER BY posted DESC LIMIT 10")
131 131
             store = result['data']
132 132
             for id,name,last_posted in cur.fetchall():
133 133
                 store.append(