Spaces:
Sleeping
Sleeping
fix sql query
Browse files
app.py
CHANGED
@@ -151,14 +151,18 @@ async def get_logs(
|
|
151 |
params.append(model)
|
152 |
|
153 |
if start:
|
154 |
-
|
|
|
|
|
155 |
params.append(start)
|
156 |
|
157 |
if end:
|
158 |
-
|
|
|
|
|
159 |
params.append(end)
|
160 |
|
161 |
-
query += " ORDER BY timestamp DESC LIMIT
|
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 |
|