mirror of
https://github.com/samsonjs/spirit-tracker.git
synced 2026-03-25 09:25:51 +00:00
fix: SKU map tool
This commit is contained in:
parent
af6d268560
commit
d291cc1492
1 changed files with 8 additions and 2 deletions
|
|
@ -37,11 +37,12 @@ let prunedAuto = 0;
|
|||
let prunedDup = 0;
|
||||
|
||||
const seen = new Set(); // dedupe after normalization
|
||||
|
||||
const nextLinks = [];
|
||||
|
||||
for (const x of Array.isArray(linksData.links) ? linksData.links : []) {
|
||||
const a = normalizeImplicitSkuKey(x?.fromSku);
|
||||
const b = normalizeImplicitSkuKey(x?.toSku);
|
||||
|
||||
if (!a || !b) {
|
||||
prunedMissing++;
|
||||
continue;
|
||||
|
|
@ -67,7 +68,12 @@ for (const x of Array.isArray(linksData.links) ? linksData.links : []) {
|
|||
}
|
||||
seen.add(key);
|
||||
|
||||
nextLinks.push({ fromSku: a, toSku: b });
|
||||
// preserve datestamps/metadata; just normalize the SKUs
|
||||
nextLinks.push({
|
||||
...x,
|
||||
fromSku: a,
|
||||
toSku: b,
|
||||
});
|
||||
}
|
||||
|
||||
linksData.links = nextLinks;
|
||||
|
|
|
|||
Loading…
Reference in a new issue