Aggiunge i tornei con hub, pagina pubblica e tabellone per semifinali e finali.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
module Public
|
||||
class TournamentResultsController < WebBaseController
|
||||
before_action :require_login!
|
||||
before_action :set_tournament
|
||||
|
||||
def create
|
||||
Tournaments::Entitlements.new(@club).assert_writable!
|
||||
match = @tournament.matches.find(params[:match_id])
|
||||
Tournaments::RecordResult.call(
|
||||
match: match,
|
||||
home_score: params[:home_score],
|
||||
away_score: params[:away_score],
|
||||
source: "manual",
|
||||
walkover: params[:walkover].presence
|
||||
)
|
||||
redirect_to public_tournament_path(@tournament, tab: params[:tab].presence || "calendario"),
|
||||
notice: t("flash.tournaments.result_saved")
|
||||
rescue Tournaments::EntitlementError => e
|
||||
redirect_to public_club_billing_path(@club), alert: e.message
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
redirect_to public_tournament_path(@tournament, tab: "calendario"), alert: e.record.errors.full_messages.join(", ")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_tournament
|
||||
@tournament = Tournament.find(params[:id])
|
||||
@club = @tournament.club
|
||||
require_club_owner!(@club)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user