Migliora overlay basket Android, regia e catalogo sport senza timer.

Fix crash e race su +3, layout tabellone con squadre ai lati, safe area in diretta e rimozione overlay cronometro; backend con sync punteggio periodo, link diretta in regia e init score_state basket.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-09 23:31:12 +02:00
parent 34c97f4447
commit 2b7e8b9e36
23 changed files with 341 additions and 167 deletions

View File

@@ -167,6 +167,7 @@ module Api
def score_sync_params
params.permit(
:home_sets, :away_sets, :home_points, :away_points, :current_set,
:clock_secs, :clock_running, :period, :home_score, :away_score, :overtime,
set_partials: %i[set home away]
)
end

View File

@@ -18,8 +18,10 @@ module Public
@rules = Scoring::Rules.from_match(@match)
@stream_closed = @session.terminal?
@on_air = !@stream_closed && mediamtx_stream_playable?(@session)
@share_url = request.original_url
@share_title = "Regia — #{@team.name} vs #{@match.opponent_name}"
@regia_share_url = request.original_url
@regia_share_title = "Regia — #{@team.name} vs #{@match.opponent_name}"
@live_share_url = @session.share_url
@live_share_title = "#{@team.name} vs #{@match.opponent_name} — Diretta Match Live TV"
end
def status

View File

@@ -2,7 +2,7 @@
module Sports
class OverlayKind
ALL = %w[none timer volley basket timed racket].freeze
ALL = %w[none volley basket timed racket].freeze
def self.valid?(value)
ALL.include?(value.to_s)

View File

@@ -99,6 +99,7 @@ class Match < ApplicationRecord
def effective_overlay_kind
kind = overlay_kind.presence || Sports::Catalog.overlay_for(sport_key)
kind = "none" if kind == "timer"
allowed = Sports::Catalog.allowed_overlays_for(sport_key)
allowed.include?(kind) ? kind : Sports::Catalog.overlay_for(sport_key)
end

View File

@@ -35,7 +35,7 @@ module Sessions
StreamSession.transaction do
session.save!
session.create_score_state!
Scoring::Engine.ensure_score_for(session)
mtx = Mediamtx::Client.new
mtx.create_path(session)
log_event(session, "pairing", { created: true, platform: session.platform })

View File

@@ -19,8 +19,10 @@
data-hls-url="<%= j @session.hls_playback_url %>"
data-home-name="<%= j @team.name %>"
data-away-name="<%= j @match.opponent_name %>"
data-share-url="<%= j @share_url %>"
data-share-title="<%= j @share_title %>"
data-regia-share-url="<%= j @regia_share_url %>"
data-regia-share-title="<%= j @regia_share_title %>"
data-live-share-url="<%= j @live_share_url %>"
data-live-share-title="<%= j @live_share_title %>"
data-points-target="<%= @match.effective_board_type.in?(%w[volley racket]) ? Scoring::Rules.from_match(@match).points_target(@score.current_set) : 0 %>"
data-stream-closed="<%= @stream_closed %>"
data-initial-paused="<%= @session.paused? %>">
@@ -33,13 +35,30 @@
</span>
</header>
<div class="regia-share">
<button type="button" class="regia-btn regia-btn--outline" id="btn-share" style="margin:0">
Condividi link regia
</button>
<button type="button" class="regia-btn regia-btn--outline" id="btn-copy" style="margin:0">
Copia link
</button>
<% if @live_share_url.present? %>
<div class="regia-share-group">
<p class="regia-share-label">Link diretta (spettatori)</p>
<div class="regia-share">
<button type="button" class="regia-btn regia-btn--outline" id="btn-share-live" style="margin:0">
Condividi diretta
</button>
<button type="button" class="regia-btn regia-btn--outline" id="btn-copy-live" style="margin:0">
Copia link
</button>
</div>
</div>
<% end %>
<div class="regia-share-group">
<p class="regia-share-label">Link regia (punteggio)</p>
<div class="regia-share">
<button type="button" class="regia-btn regia-btn--outline" id="btn-share-regia" style="margin:0">
Condividi link regia
</button>
<button type="button" class="regia-btn regia-btn--outline" id="btn-copy-regia" style="margin:0">
Copia link
</button>
</div>
</div>
<div class="regia-preview">
@@ -74,4 +93,4 @@
</div>
</div>
<script src="/regia.js?v=5"></script>
<script src="/regia.js?v=6"></script>