Skip to content

Commit

Permalink
fix(stats): ratings by year
Browse files Browse the repository at this point in the history
  • Loading branch information
believer committed Sep 27, 2024
1 parent 11af9b0 commit 9a75aa9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions db/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,9 @@ FROM
rating_series rs
LEFT JOIN rating r ON r.rating = rs.rating_value
AND r.user_id = $1
AND r.created_at >= date_trunc('year', CURRENT_DATE)
LEFT JOIN seen s ON s.movie_id = r.movie_id
AND s.user_id = $1
AND s.date >= date_trunc('year', CURRENT_DATE)
AND EXTRACT(YEAR FROM s.date) = EXTRACT(YEAR FROM $2::date)
GROUP BY
rs.rating_value
ORDER BY
Expand Down
2 changes: 1 addition & 1 deletion handlers/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func HandleGetStats(c *fiber.Ctx) error {
return err
}

yearRatings, err := getGraphWithQuery("stats-ratings-this-year", userId)
yearRatings, err := getGraphByYearWithQuery("stats-ratings-this-year", userId, currentYear)

if err != nil {
log.Fatalf("Error getting ratings this year: %v", err)
Expand Down

0 comments on commit 9a75aa9

Please sign in to comment.