Add method to update contestants through admin UI
Some checks failed
CI / scan_ruby (push) Successful in 19s
CI / scan_js (push) Successful in 14s
CI / lint (push) Successful in 13s
CI / test (push) Failing after 35s

This commit is contained in:
sto
2025-11-18 11:15:23 +01:00
parent ecb36e19ed
commit 63a88ea113
5 changed files with 35 additions and 2 deletions

View File

@@ -1,4 +1,6 @@
class UsersController < ApplicationController
include CompletionsConcern
before_action :set_user, only: %i[ destroy edit show update ]
def index
@@ -51,6 +53,26 @@ class UsersController < ApplicationController
authorize @user
end
def update_contestants
authorize :user
total = 0
updated = 0
Contestant.all.each do |contestant|
if contestant.completions.length > 0
total += 1
contestant.completions.each do |completion|
completion.save
end
if extend_completions!(contestant)
updated += 1
end
end
end
redirect_to users_path, notice: "Updated contestants: #{updated}/#{total}"
end
private
def set_user