Fix completion conversion in case of errors
This commit is contained in:
parent
ac83a599f3
commit
71f2bb6b70
@ -36,9 +36,17 @@ class CompletionsController < ApplicationController
|
||||
@completion.contest_id = @contest.id
|
||||
if @completion.save
|
||||
extend_completions!(@completion.contestant)
|
||||
redirect_to contest_path(@contest)
|
||||
if @contestant && !params[:completion].key?(:message_id)
|
||||
redirect_to edit_contest_contestant_path(@contest, @contestant)
|
||||
else
|
||||
redirect_to @contest
|
||||
end
|
||||
else
|
||||
if @contestant
|
||||
if params[:completion].key?(:message_id)
|
||||
@message = Message.find(params[:completion][:message_id])
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
elsif @contestant
|
||||
@action_name = t("helpers.buttons.back_to_contestant")
|
||||
@action_path = edit_contest_contestant_path(@contest, @contestant)
|
||||
end
|
||||
|
@ -44,6 +44,8 @@ class Completion < ApplicationRecord
|
||||
self.time_seconds = arr[0].to_i * 3600 + arr[1].to_i * 60 + arr[2].to_i
|
||||
elsif arr.size == 2
|
||||
self.time_seconds = arr[0].to_i * 60 + arr[1].to_i
|
||||
elsif arr.size == 1
|
||||
self.time_seconds = arr[0].to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -111,10 +111,10 @@ en:
|
||||
blank: Your username cannot be empty
|
||||
completions:
|
||||
edit:
|
||||
title: "Edit completion"
|
||||
title: Edit completion
|
||||
new:
|
||||
title: "New completion"
|
||||
singular: "completion"
|
||||
title: New completion
|
||||
singular: completion
|
||||
contests:
|
||||
edit:
|
||||
title: "Edit contest settings"
|
||||
@ -176,7 +176,7 @@ en:
|
||||
rank: Rank
|
||||
messages:
|
||||
convert:
|
||||
title: "New completion"
|
||||
title: New completion
|
||||
plural: "messages"
|
||||
singular: "message"
|
||||
warning: "You first need to add a puzzle before converting messages to completions."
|
||||
|
@ -82,10 +82,10 @@ fr:
|
||||
blank: Le nom d'utilisateur.ice est obligatoire
|
||||
completions:
|
||||
edit:
|
||||
title: "Modifier la complétion"
|
||||
title: Modifier la complétion
|
||||
new:
|
||||
title: "Nouvelle complétion"
|
||||
singular: "complétion"
|
||||
title: Ajout d'une complétion
|
||||
singular: complétion
|
||||
contests:
|
||||
edit:
|
||||
title: "Paramètres du concours"
|
||||
@ -147,7 +147,7 @@ fr:
|
||||
rank: Rang
|
||||
messages:
|
||||
convert:
|
||||
title: "Ajout d'une complétion"
|
||||
title: Ajout d'une complétion
|
||||
plural: "messages"
|
||||
singular: "message"
|
||||
warning: "Au moins un puzzle doit être ajouté avant de pouvoir convertir des messages en complétions."
|
||||
|
Loading…
x
Reference in New Issue
Block a user