Multiples traductions
All checks were successful
CI / scan_ruby (push) Successful in 16s
CI / scan_js (push) Successful in 14s
CI / lint (push) Successful in 14s
CI / test (push) Successful in 32s

This commit is contained in:
sto
2025-06-19 11:20:33 +02:00
parent 4645b45f5d
commit 79fb1edfaf
13 changed files with 106 additions and 32 deletions

View File

@@ -76,6 +76,8 @@ class ContestantsController < ApplicationController
def convert_csv
authorize @contest
@action_name = t("helpers.buttons.back")
@action_path = contest_path(@contest)
@csv_import = CsvImport.find(params[:id])
@content = JSON.parse(@csv_import.content)
@form = Forms::CsvConversionForm.new
@@ -92,15 +94,17 @@ class ContestantsController < ApplicationController
@content.each_with_index do |row, i|
if all_params["row_#{i}".to_sym] == "1"
if @form.email_column == -1
Contestant.create(name: row[@form.name_column], contest: @contest, time_seconds: 0)
Contestant.create(name: row[@form.name_column], contest: @contest)
else
logger.info("Email")
Contestant.create(name: row[@form.name_column], email: row[@form.email_column], contest: @contest, time_seconds: 0)
Contestant.create(name: row[@form.name_column], email: row[@form.email_column], contest: @contest)
end
end
end
redirect_to contest_path(@contest)
else
@action_name = t("helpers.buttons.back")
@action_path = contest_path(@contest)
render :convert_csv, status: :unprocessable_entity
end
end

View File

@@ -52,6 +52,8 @@ class ContestsController < ApplicationController
if @contest.update(contest_params)
redirect_to @contest
else
@action_name = t("helpers.buttons.back")
@action_path = contest_path(@contest)
render :edit, status: :unprocessable_entity
end
end