Completa multi-sport su web, API score_action e controlli Android board-aware.
Allinea i form società/squadra al catalogo sport, espone score_action per basket/timed e corregge bug namespace Sports e Result nel period engine; l'app nativa gestisce overlay e punteggio per board con wizard regole esteso. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,7 +2,7 @@ module Api
|
||||
module V1
|
||||
class SportsController < BaseController
|
||||
def index
|
||||
render json: Sports::Catalog.as_api_list
|
||||
render json: ::Sports::Catalog.as_api_list
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,6 +39,20 @@ module Api
|
||||
render json: session_json(@session, detail: true)
|
||||
end
|
||||
|
||||
def score_action
|
||||
action = params[:score_action].presence
|
||||
raise ArgumentError, "Azione mancante" if action.blank?
|
||||
|
||||
result = Scoring::ApplyAction.new(session: @session, action: action).call
|
||||
render json: session_json(@session, detail: true).merge(
|
||||
set_won: result.set_won,
|
||||
match_won: result.match_won,
|
||||
winner: result.winner&.to_s
|
||||
)
|
||||
rescue ArgumentError => e
|
||||
render json: { error: e.message }, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
def events
|
||||
events = @session.stream_events.recent.limit(100)
|
||||
render json: events.map { |e| event_json(e) }
|
||||
|
||||
@@ -21,7 +21,7 @@ module Api
|
||||
}, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
sport_key = Sports::Catalog.normalize_key(team_params[:sport_key] || team_params[:sport] || "pallavolo")
|
||||
sport_key = ::Sports::Catalog.normalize_key(team_params[:sport_key] || team_params[:sport] || "pallavolo")
|
||||
club = Club.create!(name: team_params[:name], sport: sport_key,
|
||||
primary_color: "#e53935", secondary_color: "#ffffff")
|
||||
ClubMembership.create!(user: current_user, club: club, role: "owner")
|
||||
|
||||
Reference in New Issue
Block a user