Files
puzzle-scoreboard/app/helpers/contests_helper.rb
sto b88460ae71
Some checks failed
CI / scan_ruby (push) Successful in 16s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 13s
CI / test (push) Failing after 35s
Implement projected time
2025-11-14 12:13:09 +01:00

22 lines
349 B
Ruby

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