Now the cycle works correctly and the result are saved

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