Add two new parameters to tournament
instant_finalists_amount is the amount of teams that instantly are in the finals after the group stage ends. intermediate_round_participants_amount is the amount of teams that have a chance to advance after group stage but must play a relegation game to actually do so. Both of these values need to match, so that instant_finalists_amount + (intermediate_round_participants_amount / 2) is a power of 2. Or to be more precise, the power of two that is saved in playoff_teams_amount of the tournament.
This commit is contained in:
parent
d8a9b27ab3
commit
f5b610703c
|
|
@ -1,7 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TournamentSerializer < SimpleTournamentSerializer
|
class TournamentSerializer < SimpleTournamentSerializer
|
||||||
attributes :description
|
attributes :description, :playoff_teams_amount,
|
||||||
|
:instant_finalists_amount, :intermediate_round_participants_amount
|
||||||
has_many :stages
|
has_many :stages
|
||||||
has_many :teams
|
has_many :teams
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,8 @@ class CreateSchema < ActiveRecord::Migration[5.2]
|
||||||
t.string :description
|
t.string :description
|
||||||
t.boolean :public, default: true
|
t.boolean :public, default: true
|
||||||
t.integer :playoff_teams_amount
|
t.integer :playoff_teams_amount
|
||||||
|
t.integer :instant_finalists_amount, default: 0
|
||||||
|
t.integer :intermediate_round_participants_amount, default: 0
|
||||||
|
|
||||||
# relation to owner
|
# relation to owner
|
||||||
t.belongs_to :user, index: true, null: false, foreign_key: { on_delete: :cascade }
|
t.belongs_to :user, index: true, null: false, foreign_key: { on_delete: :cascade }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue