Public scoreboard scaffold
Some checks failed
CI / scan_ruby (push) Successful in 14s
CI / scan_js (push) Successful in 12s
CI / lint (push) Successful in 11s
CI / test (push) Failing after 8s

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

@@ -26,4 +26,8 @@ class ApplicationController < ActionController::Base
flash[:error] = t "#{policy_name}.#{exception.query}", scope: "pundit", default: :default
redirect_back_or_to(root_path)
end
def not_found
render file: "#{Rails.root}/public/404.html", layout: false, status: :not_found
end
end

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