From 3a0161a0bbfc6e23ba94b60e8a438a9d62e737ce Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 3 Jul 2026 12:16:48 -0400 Subject: [PATCH] Update ChronoTrack API entry wipe functionality and enhance user feedback This commit modifies the entry wipe functionality in the ChronoTrack API admin interface. The wipe button is now disabled when there are no entries to delete, and the confirmation prompt has been updated to clarify the action's scope. Additionally, the API response for the wipe action now returns a warning state when no entries are found, providing clearer messaging about the visibility of entries. These changes aim to improve user experience and ensure accurate communication regarding entry management. --- php/chronotrack_api/fx_chronotrack_admin.php | 21 +++++++++++++------- php/chronotrack_api/fx_chronotrack_sync.php | 6 ++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/php/chronotrack_api/fx_chronotrack_admin.php b/php/chronotrack_api/fx_chronotrack_admin.php index 4ef8b55..ba36c00 100644 --- a/php/chronotrack_api/fx_chronotrack_admin.php +++ b/php/chronotrack_api/fx_chronotrack_admin.php @@ -233,9 +233,12 @@ function fxChronotrackApiAdminRenderPushPanel($intEveId, $blnClosed = false) { echo ''; echo '
'; - echo ' '; - echo 'Supprime toutes les entries CT de cet événement (MS1 intact).'; + echo ' '; + echo ''; + echo 'DELETE /api/entry/{id} — doc CT : une entry à la fois, seulement celles visibles par '; + echo 'GET event/{id}/entry. Import manuel CT ou autre événement : pas effaçable ici. '; + echo 'MS1 intact.'; echo '
'; echo '
'; echo ''; @@ -751,13 +754,16 @@ function fxChronotrackApiAdminRenderPageScript($intEveId, $arrConfig, $blnClosed $sum.html(html); renderBlockedPanel(res); $btn.prop('disabled', intTransfer <= 0); + $('#ct_api_btn_ct_wipe').prop('disabled', intCtTotal <= 0); } function renderPushResult(res, strTitle) { var $res = $('#ct_api_push_result'); var strHeading = strTitle || 'Résultat du push'; var strClass = 'text-danger'; - if (res && (res.state === 'ok' || res.state === 'partial')) { + if (res && res.state === 'warning') { + strClass = 'text-warning'; + } else if (res && (res.state === 'ok' || res.state === 'partial')) { strClass = res.state === 'ok' ? 'text-success' : 'text-warning'; } var strHtml = '
' + escHtml(strHeading) + ' — ' @@ -832,10 +838,11 @@ function fxChronotrackApiAdminRenderPageScript($intEveId, $arrConfig, $blnClosed $('#ct_api_btn_ct_wipe').on('click', function () { var intCtId = (objPushPreview && objPushPreview.ct_event_id) ? objPushPreview.ct_event_id : intLinkedCtEventId; var intCtTotal = (objPushPreview && objPushPreview.ct_total) ? objPushPreview.ct_total : 0; - var strConfirm = 'SUPPRIMER toutes les inscriptions ChronoTrack Live de cet événement ?\n\n'; + var strConfirm = 'Supprimer via l\'API ChronoTrack toutes les entries listées par GET ?\n\n'; strConfirm += 'Event CT ID : ' + intCtId + '\n'; - strConfirm += 'Entries actuelles : ' + intCtTotal + '\n\n'; - strConfirm += 'Irréversible côté ChronoTrack. MS1 ne sera pas modifié.'; + strConfirm += 'Entries visibles par l\'API : ' + intCtTotal + '\n\n'; + strConfirm += 'Ne supprime PAS les inscrits visibles seulement dans l\'interface CT (import manuel, autre event).\n'; + strConfirm += 'MS1 ne sera pas modifié.'; if (!window.confirm(strConfirm)) { return; } diff --git a/php/chronotrack_api/fx_chronotrack_sync.php b/php/chronotrack_api/fx_chronotrack_sync.php index 3c95851..3a2b89d 100644 --- a/php/chronotrack_api/fx_chronotrack_sync.php +++ b/php/chronotrack_api/fx_chronotrack_sync.php @@ -686,9 +686,11 @@ function fxChronotrackApiSyncWipeCtEvent($intEveId) { if ($intFoundBefore === 0) { return array( - 'state' => 'ok', + 'state' => 'warning', 'message' => 'L\'API ne voit aucune entry pour l\'événement CT #' . $intCtEventId - . '. Si des inscrits apparaissent encore dans l\'interface ChronoTrack, vérifiez que c\'est le même événement (ID).', + . '. Rien n\'a été supprimé. Si des inscrits apparaissent dans l\'interface ChronoTrack, ' + . 'ils ne sont probablement pas accessibles via GET event/' . $intCtEventId . '/entry ' + . '(import manuel, autre événement, ou compte API différent). Effacement manuel dans CT Live requis.', 'ct_event_id' => $intCtEventId, 'found_before' => 0, 'deleted_ok' => 0,