nbroad HF staff commited on
Commit
21d006e
1 Parent(s): 25c275f

fix sql query

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -151,14 +151,18 @@ async def get_logs(
151
  params.append(model)
152
 
153
  if start:
154
- query += " AND timestamp >= ?"
 
 
155
  params.append(start)
156
 
157
  if end:
158
- query += " AND timestamp <= ?"
 
 
159
  params.append(end)
160
 
161
- query += " ORDER BY timestamp DESC LIMIT 100"
162
 
163
  print(query, params)
164
 
 
151
  params.append(model)
152
 
153
  if start:
154
+ if not query.endswith("WHERE"):
155
+ query += " AND"
156
+ query += " timestamp >= ?"
157
  params.append(start)
158
 
159
  if end:
160
+ if not query.endswith("WHERE"):
161
+ query += " AND"
162
+ query += " timestamp <= ?"
163
  params.append(end)
164
 
165
+ query += " ORDER BY timestamp DESC LIMIT 500"
166
 
167
  print(query, params)
168