skip malformed tender rows during deduplication
This commit is contained in:
@@ -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])];
|
||||
|
||||
Reference in New Issue
Block a user