ac858f1e6d
Implement comprehensive partnership tracking system and tournament management features including round-robin, single/double elimination, and Swiss system pairings. Changes: - Add partnership_games and partnership_stats tables - Implement PartnershipTracker service for recording partnership data - Add tournament generator with multiple formats - Create tournament management actions and views - Add acceptance tests for partnership tracking - Fix PartnershipTracker to use single snapshot per player per match - Fix round-robin test to query by round_number instead of hardcoded ID Note: All 8 acceptance tests now passing
42 lines
1.2 KiB
Ruby
42 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module EuchreCamp
|
|
module Actions
|
|
module Admin
|
|
module Tournaments
|
|
class Results < EuchreCamp::Action
|
|
include Deps[
|
|
events_repo: 'repositories.events',
|
|
rounds_repo: 'repositories.tournament_rounds',
|
|
matchups_repo: 'repositories.bracket_matchups',
|
|
teams_repo: 'repositories.teams'
|
|
]
|
|
|
|
def handle(request, response)
|
|
tournament_id = request.params[:id]
|
|
|
|
tournament = events_repo.by_id(tournament_id)
|
|
current_round = rounds_repo.current_round(tournament_id)
|
|
|
|
if current_round.nil?
|
|
response.flash[:error] = "No active round to enter results"
|
|
response.redirect_to("/admin/tournaments/#{tournament_id}")
|
|
return
|
|
end
|
|
|
|
matchups = matchups_repo.by_round(current_round[:id])
|
|
teams = teams_repo.by_event(tournament_id)
|
|
|
|
response.render(view,
|
|
tournament: tournament,
|
|
round: current_round,
|
|
matchups: matchups,
|
|
teams: teams
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|