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
55 lines
1.7 KiB
Ruby
55 lines
1.7 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module EuchreCamp
|
|
module Actions
|
|
module Admin
|
|
module Tournaments
|
|
class Show < EuchreCamp::Action
|
|
include Deps[
|
|
events_repo: 'repositories.events',
|
|
participants_repo: 'repositories.event_participants',
|
|
teams_repo: 'repositories.teams',
|
|
rounds_repo: 'repositories.tournament_rounds',
|
|
players_repo: 'repositories.players'
|
|
]
|
|
|
|
def handle(request, response)
|
|
tournament_id = request.params[:id]
|
|
tournament = events_repo.by_id(tournament_id)
|
|
|
|
# Get all registered participants for this tournament
|
|
participants = participants_repo.by_event(tournament_id)
|
|
participant_ids = participants.map { |p| p[:player_id] }
|
|
|
|
# Get registered players details
|
|
players = if participant_ids.any?
|
|
players_repo.players.where(id: participant_ids).to_a
|
|
else
|
|
[]
|
|
end
|
|
|
|
# Get ALL players for the registration dropdown (not yet registered)
|
|
all_players = players_repo.all
|
|
available_players = all_players.reject { |p| participant_ids.include?(p[:id]) }
|
|
|
|
# Get teams
|
|
teams = teams_repo.by_event(tournament_id)
|
|
|
|
# Get rounds
|
|
rounds = rounds_repo.by_event(tournament_id)
|
|
|
|
response.render(view,
|
|
tournament: tournament,
|
|
players: players,
|
|
available_players: available_players,
|
|
teams: teams,
|
|
rounds: rounds,
|
|
participants: participants
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|