radames commited on
Commit
bef266a
1 Parent(s): e014e9a

order by likes and last modified

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -190,7 +190,7 @@ def get_page(page: int = 1):
190
  SELECT *, COUNT(*) OVER() AS total
191
  FROM models
192
  WHERE json_extract(data, '$.likes') > 5
193
- ORDER BY datetime(json_extract(data, '$.lastModified')) DESC
194
  LIMIT ? OFFSET ?
195
  """, (MAX_PAGE_SIZE, (page - 1) * MAX_PAGE_SIZE))
196
  results = cursor.fetchall()
 
190
  SELECT *, COUNT(*) OVER() AS total
191
  FROM models
192
  WHERE json_extract(data, '$.likes') > 5
193
+ ORDER BY json_extract(data, '$.likes') DESC, datetime(json_extract(data, '$.lastModified')) DESC
194
  LIMIT ? OFFSET ?
195
  """, (MAX_PAGE_SIZE, (page - 1) * MAX_PAGE_SIZE))
196
  results = cursor.fetchall()