Billing Stripe, link regia mobile e staff solo trasmissione.

Aggiunge fatturazione club, pagina regia condivisibile senza account, roster squadre e rimuove la modalità controller dall'app (v1.1.0).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 07:23:13 +02:00
parent 4083bc5dee
commit f4b7be0f80
156 changed files with 5033 additions and 2033 deletions

View File

@@ -6,33 +6,46 @@ module Public
def index
@query = params[:q].to_s.strip
@sessions = StreamSession
@club = Club.find_by(id: params[:club_id]) if params[:club_id].present?
team_ids = @club&.teams&.pluck(:id)
sessions = StreamSession
.broadcasting
.includes(:score_state, match: :team)
.includes(:score_state, match: { team: :club })
sessions = sessions.joins(:match).where(matches: { team_id: team_ids }) if team_ids.present?
@sessions = sessions
.search_by_team_or_opponent(@query)
.order(Arel.sql("started_at DESC NULLS LAST"), created_at: :desc)
busy_match_ids = StreamSession.where.not(status: %w[ended error]).select(:match_id)
@upcoming_matches = Match
.scheduled_upcoming
.includes(:team)
# Solo dirette già in onda: le partite «programmate» restano visibili anche se cè sessione idle.
broadcasting_match_ids = StreamSession.broadcasting.select(:match_id)
upcoming = Match.scheduled_for_live.includes(team: :club)
upcoming = upcoming.where(team_id: team_ids) if team_ids.present?
@upcoming_matches = upcoming
.search_teams_or_opponents(@query)
.where.not(id: busy_match_ids)
.where.not(id: broadcasting_match_ids)
.order(scheduled_at: :asc)
.limit(30)
.limit(50)
@online_paths = Mediamtx::Client.new.online_path_names
return unless logged_in? && @club
@schedulable_teams = current_user.schedulable_teams_for(@club)
@can_schedule_match = @schedulable_teams.any?
end
def show
@session = StreamSession.includes(match: :team).find(params[:id])
@session = StreamSession.includes(match: { team: :club }).find(params[:id])
@match = @session.match
@stream_closed = @session.terminal?
@on_air = !@stream_closed && mediamtx_online?(@session)
end
def status
session = StreamSession.includes(match: :team).find(params[:id])
session = StreamSession.includes(match: { team: :club }).find(params[:id])
closed = session.terminal?
render json: {
status: session.status,