Now the cycle works correctly and the result are saved

parent 50e9ce02
...@@ -2445,9 +2445,11 @@ class GamesThread(ThreadedComponent): ...@@ -2445,9 +2445,11 @@ class GamesThread(ThreadedComponent):
"""Select random completed matches from the database (including cancelled and failed)""" """Select random completed matches from the database (including cancelled and failed)"""
try: try:
# Get all completed matches (status = 'done', 'cancelled', or 'failed') # Get all completed matches (status = 'done', 'cancelled', or 'failed')
# Exclude matches from fixtures that contain "_recycle_" in the fixture name
completed_matches = session.query(MatchModel).filter( completed_matches = session.query(MatchModel).filter(
MatchModel.status.in_(['done', 'cancelled', 'failed']), MatchModel.status.in_(['done', 'cancelled', 'failed']),
MatchModel.active_status == True MatchModel.active_status == True,
~MatchModel.fixture_id.like('%_recycle_%')
).all() ).all()
if len(completed_matches) < count: if len(completed_matches) < count:
...@@ -2737,9 +2739,11 @@ class GamesThread(ThreadedComponent): ...@@ -2737,9 +2739,11 @@ class GamesThread(ThreadedComponent):
"""Select random completed matches from the database, excluding matches with same fighters as the last played match""" """Select random completed matches from the database, excluding matches with same fighters as the last played match"""
try: try:
# Build query for completed matches # Build query for completed matches
# Exclude matches from fixtures that contain "_recycle_" in the fixture name
query = session.query(MatchModel).filter( query = session.query(MatchModel).filter(
MatchModel.status.in_(['done', 'cancelled', 'failed']), MatchModel.status.in_(['done', 'cancelled', 'failed']),
MatchModel.active_status == True MatchModel.active_status == True,
~MatchModel.fixture_id.like('%_recycle_%')
) )
# Exclude matches with same fighters as the last played match # Exclude matches with same fighters as the last played match
......
...@@ -545,9 +545,11 @@ class MatchTimerComponent(ThreadedComponent): ...@@ -545,9 +545,11 @@ class MatchTimerComponent(ThreadedComponent):
from ..database.models import MatchModel from ..database.models import MatchModel
# Build query for completed matches # Build query for completed matches
# Exclude matches from fixtures that contain "_recycle_" in the fixture name
query = session.query(MatchModel).filter( query = session.query(MatchModel).filter(
MatchModel.status.in_(['done', 'cancelled', 'failed']), MatchModel.status.in_(['done', 'cancelled', 'failed']),
MatchModel.active_status == True MatchModel.active_status == True,
~MatchModel.fixture_id.like('%_recycle_%')
) )
# Exclude matches with same fighters as the last played match # Exclude matches with same fighters as the last played match
......
...@@ -538,8 +538,8 @@ function getFixtureStatusBadge(fixture) { ...@@ -538,8 +538,8 @@ function getFixtureStatusBadge(fixture) {
return '<span class="badge bg-primary"><i class="fas fa-money-bill me-1"></i>Bet</span>'; return '<span class="badge bg-primary"><i class="fas fa-money-bill me-1"></i>Bet</span>';
case 'ingame': case 'ingame':
return '<span class="badge bg-success"><i class="fas fa-gamepad me-1"></i>In Game</span>'; return '<span class="badge bg-success"><i class="fas fa-gamepad me-1"></i>In Game</span>';
case 'end': case 'done':
return '<span class="badge bg-dark"><i class="fas fa-stop me-1"></i>End</span>'; return '<span class="badge bg-dark"><i class="fas fa-stop me-1"></i>Done</span>';
default: default:
return '<span class="badge bg-secondary"><i class="fas fa-question me-1"></i>Unknown</span>'; return '<span class="badge bg-secondary"><i class="fas fa-question me-1"></i>Unknown</span>';
} }
...@@ -557,8 +557,8 @@ function getStatusBadge(match) { ...@@ -557,8 +557,8 @@ function getStatusBadge(match) {
return '<span class="badge bg-primary"><i class="fas fa-money-bill me-1"></i>Bet</span>'; return '<span class="badge bg-primary"><i class="fas fa-money-bill me-1"></i>Bet</span>';
case 'ingame': case 'ingame':
return '<span class="badge bg-success"><i class="fas fa-gamepad me-1"></i>In Game</span>'; return '<span class="badge bg-success"><i class="fas fa-gamepad me-1"></i>In Game</span>';
case 'end': case 'done':
return '<span class="badge bg-dark"><i class="fas fa-stop me-1"></i>End</span>'; return '<span class="badge bg-dark"><i class="fas fa-stop me-1"></i>Done</span>';
case 'cancelled': case 'cancelled':
return '<span class="badge bg-danger"><i class="fas fa-times me-1"></i>Cancelled</span>'; return '<span class="badge bg-danger"><i class="fas fa-times me-1"></i>Cancelled</span>';
case 'failed': case 'failed':
......
...@@ -451,8 +451,8 @@ function getStatusBadge(match) { ...@@ -451,8 +451,8 @@ function getStatusBadge(match) {
return '<span class="badge bg-primary"><i class="fas fa-money-bill me-1"></i>Bet</span>'; return '<span class="badge bg-primary"><i class="fas fa-money-bill me-1"></i>Bet</span>';
case 'ingame': case 'ingame':
return '<span class="badge bg-success"><i class="fas fa-gamepad me-1"></i>In Game</span>'; return '<span class="badge bg-success"><i class="fas fa-gamepad me-1"></i>In Game</span>';
case 'end': case 'done':
return '<span class="badge bg-dark"><i class="fas fa-stop me-1"></i>End</span>'; return '<span class="badge bg-dark"><i class="fas fa-stop me-1"></i>Done</span>';
case 'cancelled': case 'cancelled':
return '<span class="badge bg-danger"><i class="fas fa-times me-1"></i>Cancelled</span>'; return '<span class="badge bg-danger"><i class="fas fa-times me-1"></i>Cancelled</span>';
case 'failed': case 'failed':
......
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