Update completion -> back to contestant
All checks were successful
CI / scan_ruby (push) Successful in 15s
CI / scan_js (push) Successful in 12s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 30s

This commit is contained in:
sto 2025-06-19 11:30:21 +02:00
parent 79fb1edfaf
commit 67492cdd15

View File

@ -52,7 +52,11 @@ class CompletionsController < ApplicationController
@completion.contestant_id = params[:contestant_id] if params[:contestant_id] @completion.contestant_id = params[:contestant_id] if params[:contestant_id]
if @completion.update(completion_params) if @completion.update(completion_params)
extend_completions!(@completion.contestant) extend_completions!(@completion.contestant)
if @contestant
redirect_to edit_contest_contestant_path(@contest, @contestant)
else
redirect_to @contest redirect_to @contest
end
else else
if @contestant if @contestant
@action_name = t("helpers.buttons.back_to_contestant") @action_name = t("helpers.buttons.back_to_contestant")
@ -82,8 +86,8 @@ class CompletionsController < ApplicationController
def set_contestant def set_contestant
if params.key?(:contestant_id) if params.key?(:contestant_id)
@contestant = Contestant.find(params[:contestant_id]) @contestant = Contestant.find(params[:contestant_id])
else elsif params[:completion].key?(:contestant_id)
@contetant = nil @contestant = Contestant.find(params[:completion][:contestant_id])
end end
end end