mirror of
https://github.com/ryankazokas/turbovault-app.git
synced 2026-04-16 22:12:53 +00:00
Fixes issues with top platforms and genres
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user