Improve completions
This commit is contained in:
parent
15e2493f87
commit
570e517c28
@ -22,7 +22,7 @@ class CompletionsController < ApplicationController
|
||||
redirect_to contest_path(@contest)
|
||||
else
|
||||
logger = Logger.new(STDOUT)
|
||||
logger.info(@completion.errors.full_messages)
|
||||
logger.info(@completion.errors)
|
||||
@title = "New completion"
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
@ -42,7 +42,11 @@ class CompletionsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
@completion.destroy
|
||||
redirect_to contest_path(@contest)
|
||||
if params[:contestant_id]
|
||||
redirect_to contest_contestant_path(@contest, params[:contestant_id])
|
||||
else
|
||||
redirect_to contest_path(@contest)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -6,4 +6,6 @@ class Completion < ApplicationRecord
|
||||
attr_accessor :display_time_from_start, :display_relative_time
|
||||
|
||||
validates :time_seconds, presence: true
|
||||
validates_numericality_of :time_seconds
|
||||
validates :puzzle_id, uniqueness: { score: :contestant }
|
||||
end
|
||||
|
@ -43,8 +43,10 @@
|
||||
td
|
||||
| #{completion.puzzle.name} - #{completion.puzzle.brand}
|
||||
td
|
||||
a.btn.btn-sm.btn-secondary href=edit_contest_completion_path(@contest, completion, contestant.id)
|
||||
a.btn.btn-sm.btn-secondary.me-2 href=edit_contest_completion_path(@contest, completion, contestant.id)
|
||||
| Edit
|
||||
= link_to "Delete", contest_completion_path(contest, completion, contestant_id: contestant.id),
|
||||
data: { turbo_method: :delete }, class: "btn btn-sm btn-secondary"
|
||||
.row
|
||||
.col
|
||||
a.btn.btn-primary href=new_contest_completion_path(@contest, contestant_id: contestant.id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user