feat: data consistency check plus flexible et en francais

wip-related-pages
Sébastien Arod 2024-09-06 12:35:57 +02:00
parent 0b2c1fbc70
commit e4af267c4f
1 changed files with 11 additions and 10 deletions

View File

@ -27,32 +27,32 @@ function checkFamilyDataConsistency(family: Famille): ConsistencyReport {
if (family.Integration === null) { if (family.Integration === null) {
consistencyErrors.push({ consistencyErrors.push({
familyId: family.Titre, familyId: family.Titre,
issueType: "Résistant.e without startResistant", issueType: "Résistant.e sans date d'Intégration",
}); });
} }
if (family.Sortie !== null) { if (family.Sortie !== null) {
consistencyErrors.push({ consistencyErrors.push({
familyId: family.Titre, familyId: family.Titre,
issueType: "Résistant.e with endResistant!!", issueType: "Résistant.e avec Date de Sortie",
}); });
} }
} else if (family.Statut === "Ex résistant·e·s") { } else if (family.Statut === "Ex résistant·e·s") {
if (family.Integration === null) { if (family.Integration === null) {
consistencyErrors.push({ consistencyErrors.push({
familyId: family.Titre, familyId: family.Titre,
issueType: "Ex résistant.e.s without startResistant", issueType: "Ex résistant.e.s sans date Intégration",
}); });
} }
if (family.Sortie === null) { if (family.Sortie === null) {
consistencyErrors.push({ consistencyErrors.push({
familyId: family.Titre, familyId: family.Titre,
issueType: "Ex résistant.e.s without endResistant", issueType: "Ex résistant.e.s sans date Sortie",
}); });
} }
if (family.Integration! > family.Sortie!) { if (family.Integration! > family.Sortie!) {
consistencyErrors.push({ consistencyErrors.push({
familyId: family.Titre, familyId: family.Titre,
issueType: "startResistsant > endResistant ", issueType: "Date Intégration > date Sortie ",
}); });
} }
} }
@ -68,19 +68,20 @@ function checkFamilyDataConsistency(family: Famille): ConsistencyReport {
) !== undefined; ) !== undefined;
if ( if (
miseEnDemeureBeforeInteg && miseEnDemeureBeforeInteg &&
family.ContexteEntree !== "Après mise en demeure" family.ContexteEntree !== "Après mise en demeure" &&
family.ContexteEntree !== "Après poursuite procureur"
) { ) {
consistencyWarnings.push({ consistencyWarnings.push({
familyId: family.Titre, familyId: family.Titre,
issueType: `ContextEntree incorrect`, issueType: `Valeur de ContextEntree incorrecte: Le Context d'Entree est "${family.ContexteEntree}" alors que la date de mise en demeure avant date d'intégration`,
}); });
} }
} }
consistencyErrors.push( consistencyWarnings.push(
...family.Evenements.filter((e) => !isValidEvenementFamille(e.Type)).map( ...family.Evenements.filter((e) => !isValidEvenementFamille(e.Type)).map(
(e) => ({ (e) => ({
familyId: family.Titre, familyId: family.Titre,
issueType: `Event ${e.notionId} has unknown event Type "${e.Type}"`, issueType: `Evenement ${e.notionId} a un Type non géré: "${e.Type}"`,
}) })
) )
); );
@ -88,7 +89,7 @@ function checkFamilyDataConsistency(family: Famille): ConsistencyReport {
...family.Evenements.filter((e) => e.Type !== null && e.Date === null).map( ...family.Evenements.filter((e) => e.Type !== null && e.Date === null).map(
(e) => ({ (e) => ({
familyId: family.Titre, familyId: family.Titre,
issueType: `Event ${e.notionId} with non null Type "${e.Type}" but null Date`, issueType: `Evenement ${e.notionId} avec Type "${e.Type}" n'a pas de Date`,
}) })
) )
); );