Events: remaining fixes
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-08-06 11:26:51 +02:00
parent 77b4e06151
commit 817857ffd8
7 changed files with 58 additions and 47 deletions

View File

@@ -169,6 +169,7 @@ class ContestsController < ApplicationController
end
def scoreboard
@is_scoreboard = true
if active_page("/public/event/") == "active"
@event = Event.find_by(slug: params[:id])
unless @event && @event.shared_scoreboard && !@event.contests.where(public: true).empty?
@@ -187,6 +188,10 @@ class ContestsController < ApplicationController
else
@contest = @event.contests.where(public: true).first
end
if @contest.completions.empty? && @contest.start_time == nil
authorize @contest
render :scoreboard_not_started and return
end
else
@contest = Contest.find_by(slug: params[:id])
unless @contest && @contest.public
@@ -195,6 +200,7 @@ class ContestsController < ApplicationController
end
end
authorize @contest
@is_scoreboard_started = true
I18n.locale = @contest.lang

View File

@@ -35,14 +35,14 @@ class EventsController < ApplicationController
def show
authorize @event
@contests = @event.contests.includes([ :contestants, :puzzles ])
@contests = @event.contests.includes([ :contestants, puzzles: [ :image_attachment ] ])
@title = @event.name
end
def edit
authorize @event
@title = I18n.t("events.edit.title")
@title = @event.name
@nonav = true
end
@@ -52,7 +52,7 @@ class EventsController < ApplicationController
if @event.update(event_params)
redirect_to event_path(@event), notice: t("events.edit.notice")
else
@title = I18n.t("events.edit.title")
@title = @event.name
@nonav = true
render :edit, status: :unprocessable_entity
end