Menu spreadsheet: distinct d-tags per row (same item in different submenus) #308
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When the same dish is listed in multiple submenus (one row per submenu in the Menu Items sheet), the importer now emits one kind 30402 event per row with a distinct d-tag so events do not collide.
Changes
computeItemDTag(name, menu, section, fallbackIndex): Builds d-tag fromslugify(name)and, when menu/section exist, appends-andslugify([section, menu].filter(Boolean).join("-")). Fallback toitem-${fallbackIndex + 1}when name slug is empty.uniquifyDTags(baseDTags): Returns an array where duplicate base d-tags get-2,-3, … suffix so all are unique.baseDTagsandfinalDTagsinbuildSpreadsheetPreviewEvents; use index-based loops withfinalDTags[i]for both product events and collection membership.dTagByItemName; each row gets its own 30402 event identity.menuSpreadsheet.test.ts): same item in different submenus → two 30402 events with distinct d-tags; identical rows → distinct d-tags with-2suffix; single row without menu/section → one event with slug(name) d-tag.Result
d: bigfoot-burger(collision)d: bigfoot-burger-sandosandd: bigfoot-burger-the-unch-part-2suffixCloses #306
Closes #307