Aggiunge i tornei con hub, pagina pubblica e tabellone per semifinali e finali.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 15:05:57 +02:00
co-authored by Cursor
parent d52434fb2e
commit a1f4c24a43
124 changed files with 6979 additions and 91 deletions
+10
View File
@@ -2,6 +2,8 @@ class Team < ApplicationRecord
include Brandable
include Coverable
INTERNAL_KINDS = %w[tournament_broadcast].freeze
belongs_to :club
has_many :user_teams, dependent: :destroy
has_many :users, through: :user_teams
@@ -9,6 +11,10 @@ class Team < ApplicationRecord
has_many :recordings, dependent: :destroy
has_many :team_invitations, dependent: :destroy
has_many :roster_members, class_name: "TeamRosterMember", dependent: :destroy
has_one :broadcast_tournament, class_name: "Tournament", foreign_key: :broadcast_team_id, inverse_of: :broadcast_team
scope :visible, -> { where("internal_kind IS NULL OR internal_kind = ''") }
scope :tournament_broadcast, -> { where(internal_kind: Tournament::INTERNAL_TEAM_KIND) }
has_one_attached :photo_file
@@ -61,6 +67,10 @@ class Team < ApplicationRecord
Rails.application.routes.url_helpers.public_team_page_path(slug)
end
def tournament_broadcast?
internal_kind == Tournament::INTERNAL_TEAM_KIND
end
def sport_label
Sports::Catalog.find_optional(sport_key)&.dig(:label) || sport_key.to_s.humanize
end