Deduplicate modifiers in KDS display
Prevents showing the same modifier twice when data has duplicates. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
70781ab75e
commit
f6c3729874
1 changed files with 8 additions and 0 deletions
|
|
@ -361,12 +361,20 @@ function renderAllModifiers(modifiers, allItems) {
|
||||||
collectLeafModifiers(modifiers);
|
collectLeafModifiers(modifiers);
|
||||||
|
|
||||||
console.log(` Total leaf modifiers found: ${leafModifiers.length}`);
|
console.log(` Total leaf modifiers found: ${leafModifiers.length}`);
|
||||||
|
|
||||||
|
// Deduplicate modifiers with the same display text
|
||||||
|
const seen = new Set();
|
||||||
leafModifiers.forEach(({ mod }) => {
|
leafModifiers.forEach(({ mod }) => {
|
||||||
// Use ItemParentName (the category/template name) if available, otherwise just show the item name
|
// Use ItemParentName (the category/template name) if available, otherwise just show the item name
|
||||||
// This gives us "Drink Choice: Coke" instead of "Double Double Combo: Coke"
|
// This gives us "Drink Choice: Coke" instead of "Double Double Combo: Coke"
|
||||||
const displayText = mod.ItemParentName
|
const displayText = mod.ItemParentName
|
||||||
? `${mod.ItemParentName}: ${mod.ItemName}`
|
? `${mod.ItemParentName}: ${mod.ItemName}`
|
||||||
: mod.ItemName;
|
: mod.ItemName;
|
||||||
|
|
||||||
|
// Skip duplicates
|
||||||
|
if (seen.has(displayText)) return;
|
||||||
|
seen.add(displayText);
|
||||||
|
|
||||||
html += `<div class="modifier">+ ${escapeHtml(displayText)}</div>`;
|
html += `<div class="modifier">+ ${escapeHtml(displayText)}</div>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue