This commit is contained in:
1 parent
0cef0dd3a1
commit
f2e400c89e
6 files changed
+140
-31
No files matched your search
@@ -289,12 +289,14 @@
|
||||
const candidates = asArray(value.candidates);
|
||||
const historyRows = asArray(value.historyRows);
|
||||
const uploadLogRows = asArray(value.uploadLogRows);
|
||||
const exactPaths = new Set(asArray(value.queuePaths).map(normalizePath).filter(Boolean));
|
||||
const queuePaths = new Set(asArray(value.queuePaths).map(normalizePath).filter(Boolean));
|
||||
const exactPaths = new Set();
|
||||
for (const row of historyRows) {
|
||||
const exact = normalizePath(row?.path || row?.file);
|
||||
if (exact) exactPaths.add(exact);
|
||||
}
|
||||
const evidenceNames = new Set();
|
||||
const historyNames = new Set(historyRows.map(row => baseName(row?.fileName || row?.filename || row?.name || row?.path || row?.file)).filter(Boolean));
|
||||
for (const row of [...historyRows, ...uploadLogRows]) {
|
||||
const name = baseName(row?.fileName || row?.filename || row?.name || row?.path || row?.file);
|
||||
if (name) evidenceNames.add(name);
|
||||
@@ -307,14 +309,21 @@
|
||||
const processedPaths = [];
|
||||
const ambiguousPaths = [];
|
||||
const unprocessedPaths = [];
|
||||
const reasons = {};
|
||||
for (const candidate of candidates) {
|
||||
const exact = normalizePath(candidate?.path);
|
||||
const name = baseName(candidate?.name || candidate?.path);
|
||||
if ((exact && exactPaths.has(exact)) || (evidenceNames.has(name) && nameCounts.get(name) === 1)) processedPaths.push(candidate?.path);
|
||||
if (exact && queuePaths.has(exact)) {
|
||||
processedPaths.push(candidate?.path);
|
||||
reasons[exact] = 'in-queue';
|
||||
} else if ((exact && exactPaths.has(exact)) || (evidenceNames.has(name) && nameCounts.get(name) === 1)) {
|
||||
processedPaths.push(candidate?.path);
|
||||
reasons[exact] = exactPaths.has(exact) || historyNames.has(name) ? 'history' : 'upload-log';
|
||||
}
|
||||
else if (evidenceNames.has(name) && nameCounts.get(name) > 1) ambiguousPaths.push(candidate?.path);
|
||||
else unprocessedPaths.push(candidate?.path);
|
||||
}
|
||||
return { processedPaths, ambiguousPaths, unprocessedPaths };
|
||||
return { processedPaths, ambiguousPaths, unprocessedPaths, reasons };
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user