Commit 9679dd19 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(tournaments): Swiss-only tools say why they do not apply to game-run tournaments

Categories, manual pairing, unpairing and TRF/crosstable export belong to
the external Swiss service; for a tournament the app runs they now point to
the arbiter tools and the full JSON export instead of 'no Swiss link' or
'round not found'.
Co-Authored-By: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
parent a945b003
......@@ -703,10 +703,14 @@ class TournamentsController
'tournament_id' => "eq.{$id}",
]);
if (!$round || empty($round['swiss_round_id'])) {
if (!$round) {
Response::error('الجولة غير موجودة', '/tournaments/' . $id . '?tab=rounds');
return;
}
if (empty($round['swiss_round_id'])) {
Response::error('تعديل المواجهات يدويًا غير متاح للبطولات التي يديرها التطبيق؛ استخدم تسجيل النتيجة أو الغياب أو "إنهاء الجولة الآن"', '/tournaments/' . $id . '?tab=rounds');
return;
}
$playerAId = $_POST['player_a_id'] ?? '';
$playerBId = $_POST['player_b_id'] ?? '';
......@@ -735,10 +739,14 @@ class TournamentsController
'tournament_id' => "eq.{$id}",
]);
if (!$round || empty($round['swiss_round_id'])) {
if (!$round) {
Response::error('الجولة غير موجودة', '/tournaments/' . $id . '?tab=rounds');
return;
}
if (empty($round['swiss_round_id'])) {
Response::error('تعديل المواجهات يدويًا غير متاح للبطولات التي يديرها التطبيق؛ استخدم تسجيل النتيجة أو الغياب أو "إنهاء الجولة الآن"', '/tournaments/' . $id . '?tab=rounds');
return;
}
$response = SwissApiService::unpairRound($round['swiss_round_id']);
if (SwissApiService::isSuccess($response)) {
......@@ -920,7 +928,7 @@ class TournamentsController
$tournament = $this->db->selectOne('el3ab_tournaments', ['id' => "eq.{$id}"]);
if (!$tournament || empty($tournament['swiss_api_tournament_id'])) {
Response::json(['error' => 'Tournament not linked to Swiss API'], 400);
Response::json(['error' => 'الفئات خاصة بنظام السويسري الخارجي، ولا يستخدمها محرك التطبيق'], 400);
return;
}
......@@ -939,7 +947,7 @@ class TournamentsController
$tournament = $this->db->selectOne('el3ab_tournaments', ['id' => "eq.{$id}"]);
if (!$tournament || empty($tournament['swiss_api_tournament_id'])) {
Response::error('لا يوجد ربط مع نظام السويسري', '/tournaments/' . $id . '?tab=categories');
Response::error('الفئات خاصة بنظام السويسري الخارجي، ولا يستخدمها محرك التطبيق', '/tournaments/' . $id . '?tab=arbiter');
return;
}
......@@ -969,7 +977,7 @@ class TournamentsController
$tournament = $this->db->selectOne('el3ab_tournaments', ['id' => "eq.{$id}"]);
if (!$tournament || empty($tournament['swiss_api_tournament_id'])) {
Response::error('لا يوجد ربط مع نظام السويسري', '/tournaments/' . $id . '?tab=categories');
Response::error('الفئات خاصة بنظام السويسري الخارجي، ولا يستخدمها محرك التطبيق', '/tournaments/' . $id . '?tab=arbiter');
return;
}
......@@ -1413,7 +1421,7 @@ class TournamentsController
ExportService::downloadTRF($swissId);
} else {
http_response_code(400);
echo 'No Swiss API link for TRF export';
echo 'TRF export needs the external Swiss service. Use /tournaments/' . $id . '/export/full for tournaments the app runs.';
}
return;
......@@ -1430,7 +1438,7 @@ class TournamentsController
ExportService::downloadCrosstable($swissId);
} else {
http_response_code(400);
echo 'No Swiss API link for crosstable export';
echo 'Crosstable export needs the external Swiss service. Use /tournaments/' . $id . '/export/full for tournaments the app runs.';
}
return;
......
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