Catalogo sport in YAML, board implicito, engine per volley/basket/timed/racket/timer/generic, regia e app Android allineate. Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
795 B
Ruby
33 lines
795 B
Ruby
module Public
|
|
module RegiaHelper
|
|
def regia_board_partial(match)
|
|
board = match.effective_board_type
|
|
partial = "public/regia/#{board}"
|
|
lookup_context.exists?(partial, [], true) ? partial : "public/regia/volley"
|
|
end
|
|
|
|
def regia_header_subtitle(match, score)
|
|
board = match.effective_board_type
|
|
case board
|
|
when "basket", "timed"
|
|
live_score_period_label(match, score)
|
|
when "timer"
|
|
"Cronometro"
|
|
when "generic"
|
|
"Punteggio"
|
|
else
|
|
"Set #{score.current_set}"
|
|
end
|
|
end
|
|
|
|
def format_clock_secs(secs, count_up: false)
|
|
total = secs.to_i
|
|
return count_up ? "0:00" : "—" if total <= 0 && !count_up
|
|
|
|
m = total / 60
|
|
s = total % 60
|
|
format("%d:%02d", m, s)
|
|
end
|
|
end
|
|
end
|