Turn contest dashboard into tabs for easier navigation
Some checks failed
CI / scan_ruby (push) Successful in 20s
CI / scan_js (push) Successful in 14s
CI / lint (push) Successful in 13s
CI / test (push) Failing after 50s

This commit is contained in:
sto
2025-11-13 12:06:12 +01:00
parent 0f31265f7b
commit 97ea17b7c2
17 changed files with 265 additions and 239 deletions

View File

@@ -16,19 +16,7 @@ class ContestsController < ApplicationController
def show
authorize @contest
@title = I18n.t("contests.show.title", name: @contest.name)
@action_name = t("helpers.buttons.settings")
@action_path = "/contests/#{@contest.id}/settings/general"
@contestants = @contest.contestants.sort_by { |contestant| [
-contestant.completions.where(remaining_pieces: nil).size,
(contestant.completions.where(remaining_pieces: nil).size == @contest.puzzles.length ? 1 : 0) * contestant.time_seconds,
contestant.completions.size > 0 && contestant.completions[-1].remaining_pieces ? contestant.completions[-1].remaining_pieces : 1000000,
contestant.time_seconds
] }
filter_contestants_per_category
@puzzles = @contest.puzzles.order(:id)
@messages = @contest.messages.order(:time_seconds)
set_badges
redirect_to contest_contestants_path(@contest)
end
def edit
@@ -240,12 +228,6 @@ class ContestsController < ApplicationController
@title = I18n.t("contests.scoreboard.title", name: @contest.name)
end
def set_badges
@badges = []
@badges.push(t("helpers.badges.team")) if @contest.team
@badges.push(t("helpers.badges.registration")) if @contest.allow_registration
end
def set_contest
@contest = Contest.find(params[:id])
end