Fix: Add default 'Menu' category when no categories found

Toast extraction was finding items but no h2.groupHeader categories,
leaving items ungrouped. showItemsStep() then rendered no checkboxes,
and confirmItems() filtered out all items (empty checkedIds set).

Now adds a default "Menu" category when items exist but categories is empty.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-02-13 09:35:50 -08:00
parent b081e72347
commit 09e5807c94

View file

@ -356,6 +356,12 @@
</cfif>
</cfif>
<!--- If we have items but no categories, add a default "Menu" category --->
<cfif arrayLen(toastItems) GT 0 AND arrayLen(toastCategories) EQ 0>
<cfset arrayAppend(toastCategories, { "name": "Menu", "itemCount": arrayLen(toastItems) })>
<cfset arrayAppend(response.steps, "Added default 'Menu' category for " & arrayLen(toastItems) & " items")>
</cfif>
<cfset arrayAppend(response.steps, "Extracted " & arrayLen(toastItems) & " unique items from " & arrayLen(toastCategories) & " categories")>
<!--- Summary of business info found --->
<cfset bizKeys = structKeyList(toastBusiness)>