From 332ec93366315fa1ed7b4acd7a3407c96e8ddfa7 Mon Sep 17 00:00:00 2001 From: sadbeast Date: Wed, 31 Jan 2024 17:47:56 -0800 Subject: initial mistake --- app/controllers/leagues_controller.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 app/controllers/leagues_controller.rb (limited to 'app/controllers/leagues_controller.rb') diff --git a/app/controllers/leagues_controller.rb b/app/controllers/leagues_controller.rb new file mode 100644 index 0000000..102a9bd --- /dev/null +++ b/app/controllers/leagues_controller.rb @@ -0,0 +1,16 @@ +class LeaguesController < ApplicationController + def index + @leagues = League.all + end + + def show + league_id = params[:id] + @league = League.find_by(league_id: league_id) + + @q = LeaguePickScore.where(league_id: league_id).ransack(params[:q]) + @q.sorts = 'total desc' if @q.sorts.empty? + @scores = @q.result(distinct: true) + + @player_scores = PlayerScore.where(league_id: league_id) + end +end -- cgit v1.2.3