Class: DashboardController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DashboardController
- Defined in:
- app/controllers/dashboard_controller.rb
Overview
Handles tracking user specific gaming history and statistics
Instance Method Summary collapse
-
#game_history ⇒ Object
This method sets the game history displayed to the user.
-
#show ⇒ Object
This method sets the dashboard details displayed to the user.
Instance Method Details
#game_history ⇒ Object
This method sets the game history displayed to the user.
22 23 24 25 |
# File 'app/controllers/dashboard_controller.rb', line 22 def game_history @game = Game.find(params[:game_id]) @game_history = Dashboard.where(user_id: session[:user_id], game_id: @game.id).order(played_on: :desc) end |
#show ⇒ Object
This method sets the dashboard details displayed to the user.
Sets the following attributes aggregated for all games: total_games_played, last_played_on, streak.
Sets the following attributes for each game: name, last_played_on, score
12 13 14 15 16 17 18 19 |
# File 'app/controllers/dashboard_controller.rb', line 12 def show @dashboard_details = {} populate_total_games_played populate_last_played_on populate_streak populate_game_stats end |