puzzle-scoreboard/app/helpers/contests_helper.rb
sto 1b34d10dee
All checks were successful
CI / scan_ruby (push) Successful in 19s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 13s
CI / test (push) Successful in 43s
Improve public scoreboard UI + make it responsive
2025-06-26 10:53:21 +02:00

21 lines
342 B
Ruby

module ContestsHelper
def pad(n)
if n > 9
return n.to_s
end
"0" + n.to_s
end
def display_time(time)
h = time / 3600
m = (time % 3600) / 60
s = (time % 3600) % 60
if h > 0
return h.to_s + ":" + pad(m) + ":" + pad(s)
elsif m > 0
return m.to_s + ":" + pad(s)
end
s.to_s
end
end