Rimuovi replay da app, fix live web e sync punteggi broadcast.
La pagina live mostra solo l'overlay nel video (niente tabellone HTML); l'app nativa non espone più l'archivio replay, il toggle regole punteggio parte spento e i controlli in diretta seguono il punteggio dalla regia. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -61,57 +61,8 @@ module Public
|
||||
"#{match.team.name} #{score_state.home_points} - #{score_state.away_points} #{match.opponent_name}"
|
||||
end
|
||||
|
||||
def live_scorebug_columns(score_state)
|
||||
unless score_state
|
||||
return {
|
||||
labels: ["1"],
|
||||
home: ["0"],
|
||||
away: ["0"],
|
||||
live_index: 0
|
||||
}
|
||||
end
|
||||
|
||||
partials = Array(score_state.set_partials)
|
||||
labels = partials.map { |p| (p["set"] || p[:set]).to_s }
|
||||
home = partials.map { |p| (p["home"] || p[:home]).to_s }
|
||||
away = partials.map { |p| (p["away"] || p[:away]).to_s }
|
||||
labels << score_state.current_set.to_s
|
||||
home << score_state.home_points.to_s
|
||||
away << score_state.away_points.to_s
|
||||
{
|
||||
labels: labels,
|
||||
home: home,
|
||||
away: away,
|
||||
live_index: labels.length - 1
|
||||
}
|
||||
end
|
||||
|
||||
def live_scorebug_team_label(name, max: 16)
|
||||
n = name.to_s
|
||||
n.length <= max ? n : "#{n[0, max - 1]}…"
|
||||
end
|
||||
|
||||
# Colore ospite sul tabellone: secondario società se leggibile su bianco, altrimenti blu visitatore.
|
||||
def live_scorebug_away_color(team)
|
||||
club = team.club
|
||||
candidate = club&.effective_secondary_color.presence || "#1565c0"
|
||||
return candidate unless light_hex_color?(candidate)
|
||||
|
||||
"#1565c0"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def light_hex_color?(hex)
|
||||
h = hex.to_s.delete_prefix("#")
|
||||
return false unless h.match?(/\A\h{6}\z/i)
|
||||
|
||||
r = h[0..1].to_i(16)
|
||||
g = h[2..3].to_i(16)
|
||||
b = h[4..5].to_i(16)
|
||||
(0.299 * r + 0.587 * g + 0.114 * b) > 200
|
||||
end
|
||||
|
||||
def format_set_partial_entry(partial)
|
||||
data = partial.respond_to?(:with_indifferent_access) ? partial.with_indifferent_access : partial
|
||||
set_no = data[:set] || data["set"]
|
||||
|
||||
Reference in New Issue
Block a user