Refactor data synchronization functions for improved clarity and status reporting

This commit renames and refines several functions related to data synchronization, enhancing the clarity of status reporting. The `fxStaticSyncResolveDataStatus` function is replaced with `fxStaticSyncFinalizeCompareResult`, which consolidates status determination logic. Additionally, user feedback is improved in the synchronization process, with clearer messages regarding data discrepancies and alignment. These changes aim to streamline the synchronization workflow and enhance overall user experience.
This commit is contained in:
2026-07-06 15:17:04 -04:00
parent 709044efef
commit 5f65e1a339
2 changed files with 62 additions and 70 deletions

View File

@ -157,14 +157,12 @@ if ($strDetailTable !== '' && $strDetailEnv !== '') {
<div class="legend">
<span class="ss-ok">Données alignées</span>
<span class="ss-warn">Écarts (manque / en trop / contenu)</span>
<span class="ss-warn">Il en manque X</span>
<span class="ss-bad">Il y en a X en trop</span>
<span class="ss-warn">Contenu différent</span>
<span class="ss-schema">Structures non alignées</span>
<span class="ss-muted">Table absente / connexion</span>
</div>
<p class="count-hint" style="margin:-8px 0 16px;">
Compteur : <strong>cible · source</strong> (lignes dans l'environnement comparé · lignes en dev préprod).
Les écarts détaillent combien de clés manquent, sont en trop ou diffèrent — indépendamment du total.
</p>
<table>
<thead>
@ -250,9 +248,19 @@ if ($strDetailTable !== '' && $strDetailEnv !== '') {
<div class="detail-box">
<h2>Détails — <?php echo ssEsc($tabDef['label'] ?? $strDetailTable); ?> → <?php echo ssEsc($tabEnv['label'] ?? $strDetailEnv); ?></h2>
<p>
Manquantes : <?php echo count($tabCmp['missing_keys']); ?> —
Différences : <?php echo count($tabCmp['diff_keys']); ?> —
En trop : <?php echo count($tabCmp['extra_keys']); ?>
<?php
$intDelta = (int)$tabCmp['target_count'] - (int)$tabCmp['source_count'];
if ($intDelta < 0) {
echo 'Il en manque ' . abs($intDelta) . ' (cible ' . (int)$tabCmp['target_count']
. ' · source ' . (int)$tabCmp['source_count'] . ')';
} elseif ($intDelta > 0) {
echo 'Il y en a ' . $intDelta . ' en trop (cible ' . (int)$tabCmp['target_count']
. ' · source ' . (int)$tabCmp['source_count'] . ')';
} else {
echo 'Même nombre de lignes, contenu différent (cible ' . (int)$tabCmp['target_count']
. ' · source ' . (int)$tabCmp['source_count'] . ')';
}
?>
<?php if ($tabCmp['status'] === 'schema_mismatch') {
$tabSchemaDiff = array(
'missing_in_target' => isset($tabCmp['schema_missing_cols']) ? $tabCmp['schema_missing_cols'] : array(),