Public scoreboard scaffold

This commit is contained in:
sto
2025-03-23 08:44:38 +01:00
parent 9a2a3a6f33
commit 2982f44acc
7 changed files with 45 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
class ContestsController < ApplicationController
before_action :set_contest, only: %i[ destroy edit show update ]
skip_before_action :require_authentication, only: %i[ scoreboard ]
def index
authorize :contest
@@ -56,6 +57,20 @@ class ContestsController < ApplicationController
authorize @contest
end
def scoreboard
@contest = Contest.find_by(slug: params[:id])
unless @contest
skip_authorization
not_found and return
end
authorize @contest
@title = @contest.name
@contestants = @contest.contestants.order(:name)
@puzzles = @contest.puzzles.order(:id)
render :scoreboard
end
private
def set_badges