Implement shared scoreboard UI
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-07-31 13:02:24 +02:00
parent fe4af6d63c
commit 8a003a9731
4 changed files with 16 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ module ContestantsConcern
def ranked_contestants(contest)
if contest.ranking_mode == "actual"
contest.contestants.sort_by { |contestant| [
contest.contestants.includes([ :completions, :offline ]).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,

View File

@@ -0,0 +1,7 @@
.mt-2.row style="font-size: 16px;"
.col
ul.nav.nav-tabs.mb-4
- @contest.event.contests.where(public: true).each do |contest|
li.nav-item
a.nav-link class="#{contest == @contest ? "active" : ""}" href="/public/event/#{@contest.event.slug}?contest_id=#{contest.id}"
= contest.name

View File

@@ -1,5 +1,5 @@
.row
.mt-3.col-6.d-flex.flex-column style="height: calc(100vh - 310px)"
.row style="width: 100%;"
.mt-3.col-6.d-flex.flex-column style="height: calc(100vh - 260px)"
.d-flex.flex-column style="overflow-y: auto"
table.table.table-striped.table-hover
thead

View File

@@ -46,8 +46,12 @@ html
h1.mb-4
- if @contest && @contest.id.present?
- if active_page("/public") == "active" && @action_path
= @contest.name
.float-end style="margin-top: -5px;" id="scoreboard-switches"
- if active_page("/public/event/") == "active"
= @contest.event.name
= render "event_nav"
- else
= @contest.name
.float-end style="margin-top: #{active_page("/public/event/") == "active" ? "-18px" : "-5px"};" id="scoreboard-switches"
.d-inline-flex.align-items-center
.ms-4.form-check.form-switch style="font-size: 16px; font-weight: 300;"
input.form-check-input type="checkbox" id="refresh-checkbox"