Commit a22905bb authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: ignore 'already started' error from Swiss API during simulate

If the Swiss tournament was already started (e.g. from a previous attempt),
don't fail — just update local status and proceed with round generation.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 4f5902d2
...@@ -300,7 +300,10 @@ class BotSimulationService ...@@ -300,7 +300,10 @@ class BotSimulationService
if (in_array($tournament['status'], ['draft', 'registration'])) { if (in_array($tournament['status'], ['draft', 'registration'])) {
$startResp = ApiProxy::swiss('POST', '/tournaments/' . $swissTournamentId . '/start'); $startResp = ApiProxy::swiss('POST', '/tournaments/' . $swissTournamentId . '/start');
if (!SwissApiService::isSuccess($startResp)) { if (!SwissApiService::isSuccess($startResp)) {
return ['success' => false, 'error' => 'فشل في بدء البطولة: ' . SwissApiService::getError($startResp)]; $errMsg = SwissApiService::getError($startResp);
if (stripos($errMsg, 'already') === false && stripos($errMsg, 'only be started') === false) {
return ['success' => false, 'error' => 'فشل في بدء البطولة: ' . $errMsg];
}
} }
$db->update('el3ab_tournaments', ['id' => "eq.{$tournamentId}"], [ $db->update('el3ab_tournaments', ['id' => "eq.{$tournamentId}"], [
'status' => 'in_progress', 'status' => 'in_progress',
......
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