Improve filtering for reconciliation status in production

Update reconciliation filtering logic to handle various data types returned by PostgreSQL for boolean values (true/false, 1/0, "t"/"f", "true"/"false") and add temporary debug logging for production.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/zhCtuJP
This commit is contained in:
michaelschal committed 2025-09-21 09:13:05 +00:00
1 parent edb0e65112
commit b51f1ace40
2 files changed
+22 -2

No files matched your search

+22 -2
View File
@@ -628,9 +628,29 @@ export default function BLReconciliation() {
// Filtrage des livraisons par recherche et statut de validation
const filterDeliveries = (deliveries: any[]) => {
// Debug temporaire pour production
if (deliveries.length > 0 && filterStatus !== "all") {
console.log('🔍 DEBUG Filtre Production:', {
filterStatus,
totalDeliveries: deliveries.length,
firstDelivery: {
id: deliveries[0].id,
reconciled: deliveries[0].reconciled,
type: typeof deliveries[0].reconciled,
rawValue: JSON.stringify(deliveries[0].reconciled)
}
});
}
return deliveries.filter((delivery: any) => {
// Conversion sûre de reconciled (peut être booléen ou nombre 0/1)
const isReconciled = delivery.reconciled === true || delivery.reconciled === 1;
// Conversion sûre de reconciled - gestion de tous les cas possibles
// PostgreSQL peut retourner : true/false, 1/0, "t"/"f", "true"/"false"
const isReconciled =
delivery.reconciled === true ||
delivery.reconciled === 1 ||
delivery.reconciled === "t" ||
delivery.reconciled === "true" ||
(typeof delivery.reconciled === 'string' && delivery.reconciled.toLowerCase() === 'true');
// Filtre par statut validé
if (filterStatus === "validated" && !isReconciled) {