# Fixture is from yesterday - activate yesterday fixture first to play remaining matches, create today fixture for later
logger.info(f"Fixture {fixture_id} is from yesterday and has remaining matches - activating yesterday fixture first, will create today fixture after completion")
new_fixture_id=self._initialize_new_fixture()
ifnew_fixture_id:
# Store the today fixture ID for later use
self.pending_today_fixture_id=new_fixture_id
logger.info(f"Created today fixture {new_fixture_id} - will play yesterday matches first, then switch to today")
# Activate yesterday fixture to play remaining matches
self._activate_fixture(fixture_id,message)
return
else:
logger.warning("Could not create today fixture - activating yesterday fixture as fallback")
self._activate_fixture(fixture_id,message)
return
else:
# Fixture is from today - check if enough matches are available
logger.info(f"Fixture {fixture_id} has active matches - activating")
# Check if at least 5 non-completed matches are available
...
...
@@ -366,7 +571,6 @@ class GamesThread(ThreadedComponent):
ifnon_completed_count>=5:
# Enough matches, activate
self._activate_fixture(fixture_id,message)
self._start_async_zip_validation(fixture_id)
return
else:
# Not enough matches, create new ones from templates
...
...
@@ -725,22 +929,65 @@ class GamesThread(ThreadedComponent):
).count()
ifactive_count==0:
logger.info(f"All matches completed for fixture {self.current_fixture_id} - checking day change for new fixture creation")
# Check if day has changed - if so, create new fixture with new fixture_id
day_changed=self._check_and_handle_day_change()
ifday_changed:
logger.info("Day change detected - creating new fixture with new fixture_id")
new_fixture_id=self._initialize_new_fixture()
logger.info(f"All matches completed for fixture {self.current_fixture_id} - checking for new fixture creation")
# Check if we need to create new matches and if current fixture's first match is from yesterday