Fixes issues with top platforms and genres

This commit is contained in:
2026-03-29 04:18:42 -04:00
parent 311ad21474
commit f73aa118ac
2 changed files with 9 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -15,6 +15,14 @@ class DashboardController < ApplicationController
@backlog_games = current_user.games.backlog.count @backlog_games = current_user.games.backlog.count
@total_spent = current_user.games.sum(:price_paid) || 0 @total_spent = current_user.games.sum(:price_paid) || 0
@games_by_platform = current_user.games.joins(:platform) @games_by_platform = current_user.games.joins(:platform)
.group("platforms.name")
.count
.sort_by { |_platform, count| -count }
.first(10)
@games_by_genre = current_user.games.joins(:genres) @games_by_genre = current_user.games.joins(:genres)
.group("genres.name")
.count
.sort_by { |_genre, count| -count }
.first(10)
end end
end end