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

@@ -68,6 +68,8 @@
.form-floating .form-floating
= form.text_field :display_time_from_start, autocomplete: "off", class: "form-control", id: "time" = form.text_field :display_time_from_start, autocomplete: "off", class: "form-control", id: "time"
= form.label :display_time_from_start, class: "required" = form.label :display_time_from_start, class: "required"
.form-text
= t("activerecord.attributes.completion.display_time_from_start_description")
.row.mb-3 id="missing_pieces" .row.mb-3 id="missing_pieces"
.col .col
.form-floating .form-floating

View File

@@ -1,2 +1,2 @@
h4 h4
= "Puzzle validated for #{@contestant.name}!" = "Puzzle validé pour #{@contestant.name} !"

View File

@@ -64,34 +64,49 @@ css:
- else - else
.d-flex.flex-column style="height: calc(100vh - 180px)" .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" = render "selectors"
.d-flex.flex-column style="overflow-y: auto" .d-flex.flex-column style="overflow-y: auto"
table.table.table-striped.table-hover .table-responsive-md
thead table.table.table-striped.table-hover
tr thead
th scope="col" tr
= t("helpers.rank") th
th scope="col" th
= t("activerecord.attributes.contestant.name") th
- if @contest.puzzles.size > 1 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" th scope="col"
= t("activerecord.attributes.contestant.completions") = t("activerecord.attributes.contestant.completions")
th scope="col" th scope="col"
= t("activerecord.attributes.contestant.display_time") = t("activerecord.attributes.contestant.display_time")
tbody - @contest.puzzles.each do |puzzle|
- @contestants.each_with_index do |contestant, index| th scope="col"
tr scope="row" = puzzle.name
td tbody
= index + 1 - @contestants.each_with_index do |contestant, index|
td tr scope="row"
= contestant.name td
- if @contest.puzzles.size > 1 = index + 1
td
= contestant.name
td td
= contestant.completions.where(remaining_pieces: nil).length = contestant.completions.where(remaining_pieces: nil).length
td 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 = 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"

View File

@@ -47,6 +47,7 @@ en:
contestant: Participant contestant: Participant
display_time: Time display_time: Time
display_time_from_start: Time since start display_time_from_start: Time since start
display_time_from_start_description: Format mm:ss or h:mm:ss
display_relative_time: Time for this puzzle display_relative_time: Time for this puzzle
puzzle: Puzzle puzzle: Puzzle
missing_pieces: Missing pieces missing_pieces: Missing pieces
@@ -284,7 +285,7 @@ en:
rank: Rank rank: Rank
lib: lib:
ranking: ranking:
actual: First by time if completed, then by number of pieces assembled actual: First by number of pieces assembled, then by time
theorical: By time only (projected time calculated with the ppm count) theorical: By time only (projected time calculated with the ppm count)
messages: messages:
index: index:

View File

@@ -18,6 +18,7 @@ fr:
contestant_id: Participant.e contestant_id: Participant.e
display_time: Temps display_time: Temps
display_time_from_start: Temps depuis le début display_time_from_start: Temps depuis le début
display_time_from_start_description: Format mm:ss ou h:mm:ss
display_relative_time: Temps pour ce puzzle display_relative_time: Temps pour ce puzzle
puzzle: Puzzle puzzle: Puzzle
missing_pieces: Pièces manquantes missing_pieces: Pièces manquantes
@@ -255,7 +256,7 @@ fr:
rank: Rang rank: Rang
lib: lib:
ranking: ranking:
actual: Par temps d'abord, puis par nombre de pièces assemblées actual: Par nombre de pièces assemblées, puis par temps
theorical: Par temps uniquement (temps projeté calculé à partir de la vitesse d'assemblage) theorical: Par temps uniquement (temps projeté calculé à partir de la vitesse d'assemblage)
messages: messages:
index: index: