Fix days-filter in aggregate_model_usage: COALESCE(startTime,'') is invalid SQL (empty-string not a timestamp) — windowed queries always failed to empty
This commit is contained in:
1 parent
69beb9c002
commit
19c04f37fa
1 file changed
+2
-2
+2
-2
@@ -248,9 +248,9 @@ def aggregate_model_usage(days: int = 0, team_id: str | None = None) -> dict:
|
|||||||
if days and days > 0:
|
if days and days > 0:
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
cutoff = (datetime.now(timezone.utc) - timedelta(days=days)).strftime(
|
cutoff = (datetime.now(timezone.utc) - timedelta(days=days)).strftime(
|
||||||
"%Y-%m-%dT%H:%M:%S"
|
"%Y-%m-%d %H:%M:%S"
|
||||||
)
|
)
|
||||||
where.append("COALESCE(\"startTime\", '') >= %s")
|
where.append("\"startTime\" >= %s")
|
||||||
params.append(cutoff)
|
params.append(cutoff)
|
||||||
if team_id:
|
if team_id:
|
||||||
where.append("team_id = %s")
|
where.append("team_id = %s")
|
||||||
|
|||||||
Reference in new issue
Block a user