Allinea stato e titolo replay del tabellone al risultato reale.
Una gara con punteggio non resta più «In programma» solo perché l'orario è futuro, e i replay usano le squadre del match invece della squadra di trasmissione. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -100,8 +100,8 @@ module Public
|
||||
def tournament_public_board_state(match)
|
||||
return :live if tournament_public_live_session(match)
|
||||
return :replay if tournament_public_recording(match)
|
||||
return :ended if match.played? || match.result_status.to_s.start_with?("walkover") || match.home_score.present?
|
||||
return :scheduled if match.scheduled_upcoming?
|
||||
return :ended if match.played? || match.home_score.present?
|
||||
|
||||
:waiting
|
||||
end
|
||||
|
||||
@@ -146,14 +146,22 @@ class Recording < ApplicationRecord
|
||||
end
|
||||
|
||||
def title_or_default
|
||||
title.presence || default_title
|
||||
match = stream_session&.match
|
||||
return title.presence || "Replay" unless match
|
||||
|
||||
generated = match.matchup_label
|
||||
stored = title.to_s.strip
|
||||
return generated if stored.blank?
|
||||
return generated if stale_auto_title?(match, stored)
|
||||
|
||||
stored
|
||||
end
|
||||
|
||||
def default_title
|
||||
match = stream_session&.match
|
||||
return "Replay" unless match
|
||||
|
||||
"#{match.team.name} vs #{match.opponent_name}"
|
||||
match.matchup_label
|
||||
end
|
||||
|
||||
def recorded_at_or_fallback
|
||||
@@ -222,6 +230,18 @@ class Recording < ApplicationRecord
|
||||
|
||||
private
|
||||
|
||||
def stale_auto_title?(match, stored)
|
||||
return false unless match.tournament_match?
|
||||
|
||||
team_name = match.team&.name.to_s
|
||||
return false if team_name.blank?
|
||||
|
||||
[
|
||||
"#{team_name} vs #{match.opponent_name}",
|
||||
"#{team_name} vs #{match.away_display_name}"
|
||||
].include?(stored)
|
||||
end
|
||||
|
||||
def normalize_privacy_status
|
||||
self.privacy_status = "public" if privacy_status == "private"
|
||||
self.privacy_status = "unlisted" if privacy_status.blank?
|
||||
|
||||
@@ -73,7 +73,7 @@ module Recordings
|
||||
|
||||
def default_title
|
||||
match = @session.match
|
||||
"#{match.team.name} vs #{match.opponent_name}"
|
||||
match.matchup_label.presence || "Replay"
|
||||
end
|
||||
|
||||
def privacy_from_session
|
||||
|
||||
@@ -52,8 +52,11 @@
|
||||
<span class="replay-card__play" aria-hidden="true">▶</span>
|
||||
</div>
|
||||
<div class="replay-card__body">
|
||||
<strong class="replay-card__title"><%= rec.title.presence || match.matchup_label %></strong>
|
||||
<p class="replay-card__meta"><%= match.matchup_label %></p>
|
||||
<% phase = [match.tournament_round&.name, match.tournament_group&.name].compact.first %>
|
||||
<strong class="replay-card__title"><%= match.matchup_label %></strong>
|
||||
<p class="replay-card__meta">
|
||||
<%= [phase, rec.recorded_at_or_fallback && l(rec.recorded_at_or_fallback, format: :short)].compact.join(" · ") %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user