Add fxChronotrackApiSyncEpreuveLabel function for improved race labeling in exclusion messages. Update error handling to include detailed race information when mapping issues occur, enhancing clarity in synchronization logs.
This commit is contained in:
@ -83,6 +83,21 @@ function fxChronotrackApiSyncParticipantLabel(array $arrRow) {
|
||||
return trim(trim((string)($arrRow['par_prenom'] ?? '')) . ' ' . trim((string)($arrRow['par_nom'] ?? '')));
|
||||
}
|
||||
|
||||
/**
|
||||
* MSIN-4328 — libellé épreuve MS1 (type — nom), pour messages d’exclusion.
|
||||
*/
|
||||
function fxChronotrackApiSyncEpreuveLabel(array $arrRow) {
|
||||
$strNom = trim((string)($arrRow['epr_nom'] ?? ''));
|
||||
$strType = trim((string)($arrRow['epr_type'] ?? ''));
|
||||
if ($strType !== '' && $strNom !== '') {
|
||||
return $strType . ' — ' . $strNom;
|
||||
}
|
||||
if ($strNom !== '') {
|
||||
return $strNom;
|
||||
}
|
||||
return $strType;
|
||||
}
|
||||
|
||||
function fxChronotrackApiSyncIsTeamRow(array $arrRow) {
|
||||
return intval($arrRow['pec_equipe'] ?? 0) === 1 || intval($arrRow['par_equipe'] ?? 0) === 1;
|
||||
}
|
||||
@ -222,9 +237,18 @@ function fxChronotrackApiSyncClassifyParticipants(array $tabParticipants, array
|
||||
$intCtRaceId = intval($arrRaceMap[$intEprId]['ct_race_id'] ?? 0);
|
||||
if ($intCtRaceId <= 0) {
|
||||
$arrSummary = fxChronotrackApiSyncParticipantSummary($arrRow);
|
||||
$strEprLabel = fxChronotrackApiSyncEpreuveLabel($arrRow);
|
||||
// MSIN-4328 — nom d’épreuve en premier (epr_id en secours)
|
||||
if ($strEprLabel !== '') {
|
||||
$strMsg = '« ' . $strEprLabel . ' » (epr_id ' . $intEprId . ') non mappée vers ChronoTrack';
|
||||
} else {
|
||||
$strMsg = 'Épreuve MS1 (epr_id ' . $intEprId . ') non mappée vers ChronoTrack';
|
||||
}
|
||||
$tabBlocked[] = array(
|
||||
'code' => 'no_race',
|
||||
'message' => 'Épreuve MS1 (epr_id ' . $intEprId . ') non mappée vers ChronoTrack',
|
||||
'message' => $strMsg,
|
||||
'epr_id' => $intEprId,
|
||||
'epr_nom' => $strEprLabel,
|
||||
) + $arrSummary;
|
||||
continue;
|
||||
}
|
||||
@ -415,10 +439,12 @@ function fxChronotrackApiSyncLoadMs1Participants($intEveId) {
|
||||
. " p.par_naissance, p.no_bib, p.par_statut_course, p.par_ville, p.par_adresse, p.par_codepostal,"
|
||||
. " p.is_cancelled, p.par_maj,"
|
||||
. " ec.pec_equipe, ec.no_equipe, ec.pec_nom_equipe,"
|
||||
. " ie.epr_nom_fr AS epr_nom, ie.epr_type_fr AS epr_type,"
|
||||
. " (SELECT pro_iso FROM inscriptions_provinces WHERE pro_id = p.pro_id) AS state_iso,"
|
||||
. $strCountryCols
|
||||
. " FROM resultats_participants p"
|
||||
. " JOIN resultats_epreuves_commandees ec ON p.pec_id = ec.pec_id_original"
|
||||
. " LEFT JOIN inscriptions_epreuves ie ON ie.epr_id = p.epr_id"
|
||||
. " WHERE ec.pec_actif = 1 AND ec.is_cancelled = 0 AND p.is_cancelled = 0"
|
||||
. " AND p.eve_id = " . $intEveId
|
||||
. " ORDER BY p.par_id_original, p.par_id";
|
||||
|
||||
Reference in New Issue
Block a user