match creation in bet mode

parent 36ae42f5
......@@ -672,6 +672,14 @@ class MatchTimerComponent(ThreadedComponent):
try:
from ..database.models import MatchModel
# Get betting mode configuration
betting_mode = self._get_betting_mode_config()
# If betting mode is "all_bets_on_start", new matches should be 'bet'
if betting_mode == "all_bets_on_start":
logger.info(f"Betting mode is 'all_bets_on_start' - new matches will be in bet status")
return 'bet'
# Check if system is ingame (has any match with status 'ingame')
ingame_match = session.query(MatchModel).filter(
MatchModel.status == 'ingame',
......@@ -698,6 +706,33 @@ class MatchTimerComponent(ThreadedComponent):
logger.error(f"Failed to determine new match status: {e}")
return 'scheduled' # Default fallback
def _get_betting_mode_config(self) -> str:
"""Get global betting mode configuration from game config (default: 'all_bets_on_start')"""
try:
session = self.db_manager.get_session()
try:
from ..database.models import GameConfigModel
# Get global betting mode configuration from game_config table
betting_mode_config = session.query(GameConfigModel).filter_by(
config_key='betting_mode'
).first()
if betting_mode_config:
return betting_mode_config.get_typed_value()
else:
# Default to 'all_bets_on_start' if no configuration found
logger.debug("No betting mode configuration found, using default: 'all_bets_on_start'")
return 'all_bets_on_start'
finally:
session.close()
except Exception as e:
logger.error(f"Failed to get betting mode config: {e}")
# Default fallback
return 'all_bets_on_start'
def _send_timer_update(self):
"""Send timer update message to all clients"""
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment