skip malformed tender rows during deduplication

This commit is contained in:
2026-09-06 18:09:06 +03:00
parent 6b3b446e49
commit 6e78485228
3 changed files with 12 additions and 0 deletions
+2
View File
@@ -11,6 +11,8 @@ export function tenderIdentity(t) {
export function uniqueTenders(records) {
const found = new Map();
for (const t of records) {
// Kaynaklardan gelen bozuk/null satırlar tüm havuz birleştirmesini düşürmemeli.
if (!t || typeof t !== 'object' || Array.isArray(t) || typeof t.id !== 'string' || !t.id.trim()) continue;
const key = tenderIdentity(t), old = found.get(key);
if (!old) { found.set(key,{...t,sourceIds:[t.id]}); continue; }
const sourceIds = [...new Set([...old.sourceIds,t.id])];