Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit ccc63ca

Browse files
committed
database: Fix "can't scan into dest" error on Usage page
1 parent 7f58212 commit ccc63ca

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

common/database/api_call_log.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ func ApiUsageData(user string, from, to time.Time) (usage []ApiUsage, err error)
6969
FROM users
7070
WHERE lower(user_name) = lower($1)
7171
)
72-
SELECT to_char(api_call_date, 'YYYY-MM-DD') AS dt, count(*) AS num_calls, (sum(runtime) / 1000)::bigint AS runtime, sum(request_size) AS request_size, sum(response_size) AS response_size
72+
SELECT to_char(api_call_date, 'YYYY-MM-DD') AS dt,
73+
count(*) AS num_calls,
74+
coalesce((sum(runtime) / 1000)::bigint, 0) AS runtime,
75+
coalesce(sum(request_size), 0) AS request_size,
76+
coalesce(sum(response_size), 0) AS response_size
7377
FROM api_call_log
7478
WHERE caller_id=(SELECT user_id FROM userData) AND api_call_date>=$2 AND api_call_date<=$3
7579
GROUP BY dt ORDER BY dt`

0 commit comments

Comments
 (0)