Display time per puzzle for marathon scoreboards
Some checks failed
CI / scan_ruby (push) Failing after 21s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 14s
CI / test (push) Failing after 36s

This commit is contained in:
sto
2025-11-27 16:26:37 +01:00
parent 66d968fca8
commit d01775471e
5 changed files with 45 additions and 26 deletions

View File

@@ -64,34 +64,49 @@ css:
- else
.d-flex.flex-column style="height: calc(100vh - 180px)"
.d-flex.flex-row.justify-content-center.mb-5
- @contest.puzzles.each do |puzzle|
= image_tag(puzzle.image, class: "img-fluid ms-3 me-3", style: "max-height: 220px") if puzzle.image.attached?
= render "selectors"
.d-flex.flex-column style="overflow-y: auto"
table.table.table-striped.table-hover
thead
tr
th scope="col"
= t("helpers.rank")
th scope="col"
= t("activerecord.attributes.contestant.name")
- if @contest.puzzles.size > 1
.table-responsive-md
table.table.table-striped.table-hover
thead
tr
th
th
th
th
- @contest.puzzles.each do |puzzle|
th scope="col"
= image_tag(puzzle.image, class: "img-fluid", style: "max-height: 64px;") if puzzle.image.attached?
tr
th scope="col"
= t("helpers.rank")
th scope="col"
= t("activerecord.attributes.contestant.name")
th scope="col"
= t("activerecord.attributes.contestant.completions")
th scope="col"
= t("activerecord.attributes.contestant.display_time")
tbody
- @contestants.each_with_index do |contestant, index|
tr scope="row"
td
= index + 1
td
= contestant.name
- if @contest.puzzles.size > 1
th scope="col"
= t("activerecord.attributes.contestant.display_time")
- @contest.puzzles.each do |puzzle|
th scope="col"
= puzzle.name
tbody
- @contestants.each_with_index do |contestant, index|
tr scope="row"
td
= index + 1
td
= contestant.name
td
= contestant.completions.where(remaining_pieces: nil).length
td
= contestant.completions.size > 0 && contestant.completions[-1].remaining_pieces ? "#{contestant.completions.map{|completion| completion.puzzle.pieces}.sum - contestant.completions[-1].remaining_pieces}p" : contestant.display_time
td
= contestant.completions.size > 0 && contestant.completions[-1].remaining_pieces ? "#{contestant.completions.map{|completion| completion.puzzle.pieces}.sum - contestant.completions[-1].remaining_pieces}p" : contestant.display_time
- @contest.puzzles.each do |puzzle|
td
- contestant.completions.each do |completion|
- if completion.puzzle == puzzle
- if completion.completed
= completion.display_relative_time
- else
= "#{puzzle.pieces - completion.remaining_pieces}p"