feat(tournaments): add partnership tracking and tournament management
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
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rom-repository'
|
||||
|
||||
module EuchreCamp
|
||||
module Repositories
|
||||
class TournamentRounds < ::EuchreCamp::Repository[:tournament_rounds]
|
||||
commands :create, update: :by_pk, delete: :by_pk
|
||||
|
||||
def by_event(event_id)
|
||||
tournament_rounds.where(event_id: event_id).order(:round_number).to_a
|
||||
end
|
||||
|
||||
def current_round(event_id)
|
||||
tournament_rounds
|
||||
.where(event_id: event_id, status: 'active')
|
||||
.order(Sequel.desc(:round_number))
|
||||
.one
|
||||
end
|
||||
|
||||
def next_round(event_id)
|
||||
tournament_rounds
|
||||
.where(event_id: event_id, status: 'pending')
|
||||
.order(:round_number)
|
||||
.limit(1)
|
||||
.one
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user