radames commited on
Commit
6adeb37
1 Parent(s): 42e31b9

different order

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -138,6 +138,7 @@ async def get_all_new_models():
138
  new_models += page_models['models']
139
  return new_models
140
 
 
141
  async def sync_data():
142
  print("Fetching models")
143
  new_models = await get_all_new_models()
@@ -176,7 +177,6 @@ async def sync_data():
176
  })])
177
  db.commit()
178
 
179
-
180
  # print("Updating repository")
181
  # subprocess.Popen(
182
  # "git add . && git commit --amend -m 'update' && git push --force", cwd=DB_FOLDER, shell=True)
@@ -210,7 +210,7 @@ def get_page(page: int = 1):
210
  SELECT *, COUNT(*) OVER() AS total
211
  FROM models
212
  WHERE json_extract(data, '$.likes') > 4
213
- ORDER BY datetime(json_extract(data, '$.lastModified')) DESC
214
  LIMIT ? OFFSET ?
215
  """, (MAX_PAGE_SIZE, (page - 1) * MAX_PAGE_SIZE))
216
  results = cursor.fetchall()
 
138
  new_models += page_models['models']
139
  return new_models
140
 
141
+
142
  async def sync_data():
143
  print("Fetching models")
144
  new_models = await get_all_new_models()
 
177
  })])
178
  db.commit()
179
 
 
180
  # print("Updating repository")
181
  # subprocess.Popen(
182
  # "git add . && git commit --amend -m 'update' && git push --force", cwd=DB_FOLDER, shell=True)
 
210
  SELECT *, COUNT(*) OVER() AS total
211
  FROM models
212
  WHERE json_extract(data, '$.likes') > 4
213
+ ORDER BY datetime(json_extract(data, '$.lastModified')) DESC, json_extract(data, '$.likes') DESC
214
  LIMIT ? OFFSET ?
215
  """, (MAX_PAGE_SIZE, (page - 1) * MAX_PAGE_SIZE))
216
  results = cursor.fetchall()