Fix completion form bugs
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
sto
2026-09-10 16:58:51 +02:00
parent 4e1c2a2bb6
commit dafd4cf4ce
3 changed files with 4 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ class CompletionsController < ApplicationController
if params[:contestant_id]
@completion.contestant_id = params[:contestant_id]
end
@completion.contest = @contest
end
def create

View File

@@ -82,6 +82,7 @@ class MessagesController < ApplicationController
@completion = Completion.new()
@completion.display_time_from_start = @message.display_time
@completion.completed = true
@completion.contest = @contest
render "completions/new"
end

View File

@@ -118,7 +118,7 @@
.form-floating
= form.text_field :display_time_from_start, autocomplete: "off", class: "form-control", id: "time"
= form.label :display_time_from_start, class: "required"
- unless method == :patch || @contest.start_time == nil
- unless method == :patch || @contest.start_time == nil || @message
.col.mt-2
a.btn.btn-primary id="refresh" style="display: #{@completion.completed ? "" : "none"}"
= t("helpers.buttons.refresh")
@@ -126,7 +126,7 @@
= t("activerecord.attributes.completion.display_time_from_start_description")
/ Refresh logic.
- if @contest.start_time.present? && method != :patch
- if @contest.start_time.present? && method != :patch && !@message
javascript:
startTime = #{@contest.start_time.present? ? @contest.start_time.to_i : "null"};
pauseTime = #{@contest.pause_time.present? ? @contest.pause_time.to_i : "null"};