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:
26
backend/app/services/scoring/engine.rb
Normal file
26
backend/app/services/scoring/engine.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
module Scoring
|
||||
class Engine
|
||||
ENGINES = {
|
||||
"volley" => Engines::VolleyEngine,
|
||||
"racket" => Engines::RacketEngine,
|
||||
"generic" => Engines::GenericEngine,
|
||||
"basket" => Engines::BasketEngine,
|
||||
"timed" => Engines::TimedEngine,
|
||||
"timer" => Engines::TimerEngine
|
||||
}.freeze
|
||||
|
||||
def self.for(match)
|
||||
board = match.effective_board_type
|
||||
klass = ENGINES.fetch(board) { Engines::GenericEngine }
|
||||
klass.new(match: match)
|
||||
end
|
||||
|
||||
def self.for_session(session)
|
||||
for(session.match)
|
||||
end
|
||||
|
||||
def self.ensure_score_for(session)
|
||||
for(session.match).ensure_score(session)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user