Skip to content

Commit

Permalink
fix zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
YaroslavPodorvanov committed Jun 22, 2024
1 parent 9402b2a commit 8dfb1f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions internal/storage/dbs/profile_hourly_views_stats.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/storage/queries/profile_hourly_views_stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ ON CONFLICT (user_id, time) DO UPDATE

-- name: ProfileHourlyViewsStats :many
SELECT user_id,
SUM(count) FILTER ( WHERE time >= @day ) AS day_count,
SUM(count) FILTER ( WHERE time >= @week ) AS week_count,
SUM(count) AS month_count
COALESCE(SUM(count) FILTER ( WHERE time >= @day ), 0)::BIGINT AS day_count,
COALESCE(SUM(count) FILTER ( WHERE time >= @week ), 0)::BIGINT AS week_count,
SUM(count) AS month_count
FROM profile_hourly_views_stats
WHERE user_id = ANY (@user_ids::BIGINT[])
AND time >= @month
Expand Down

0 comments on commit 8dfb1f9

Please sign in to comment.