Introduce architettura multi-sport con catalogo, engine scoring e overlay.
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>
This commit is contained in:
32
backend/app/helpers/public/regia_helper.rb
Normal file
32
backend/app/helpers/public/regia_helper.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
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
|
||||
Reference in New Issue
Block a user