Fix display_time
All checks were successful
CI / scan_ruby (push) Successful in 15s
CI / scan_js (push) Successful in 12s
CI / lint (push) Successful in 11s
CI / test (push) Successful in 26s

This commit is contained in:
sto 2025-06-21 10:54:20 +02:00
parent 4b5c09f63b
commit 2969a24cb0
2 changed files with 10 additions and 9 deletions

View File

@ -8,15 +8,16 @@ module CompletionsConcern
"0" + n.to_s "0" + n.to_s
end end
def display_time(seconds) def display_time(time)
if seconds > 3600 h = time / 3600
hours = seconds / 3600 m = (time % 3600) / 60
return hours.to_s + ":" + display_time(seconds % 3600) s = (time % 3600) % 60
elsif seconds > 60 if h > 0
minutes = seconds / 60 return h.to_s + ":" + pad(m) + ":" + pad(s)
return pad(minutes) + ":" + display_time(seconds % 60) elsif m > 0
return m.to_s + ":" + pad(s)
end end
pad(seconds) s.to_s
end end
def extend_completions!(contestant) def extend_completions!(contestant)

View File

@ -28,7 +28,7 @@ javascript:
</svg> </svg>
=< t("contests.show.copy_extension_url") =< t("contests.show.copy_extension_url")
.row.mb-4 style="height: calc(100vh - 320px)" .row.mb-4 style="height: calc(100vh - 280px)"
.col-7.d-flex.flex-column style="height: 100%" .col-7.d-flex.flex-column style="height: 100%"
.row .row
.col .col