Handle struct types in item category and modifiers during merge
Claude sometimes returns category or modifiers as objects instead of strings. Added isSimpleValue checks to prevent cast errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d8a308a03e
commit
9a28091601
1 changed files with 4 additions and 2 deletions
|
|
@ -401,7 +401,8 @@
|
|||
</cfif>
|
||||
|
||||
<!--- Get item's category --->
|
||||
<cfset itemCategory = structKeyExists(item, "category") ? trim(item.category) : "">
|
||||
<cfset itemCatRaw = structKeyExists(item, "category") ? item.category : "">
|
||||
<cfset itemCategory = isSimpleValue(itemCatRaw) ? trim(itemCatRaw) : "">
|
||||
|
||||
<!--- Find category-level modifiers for this category --->
|
||||
<cfif len(itemCategory)>
|
||||
|
|
@ -412,7 +413,8 @@
|
|||
<!--- Check if modifier is not already assigned --->
|
||||
<cfset alreadyAssigned = false>
|
||||
<cfloop array="#item.modifiers#" index="existingMod">
|
||||
<cfif lCase(existingMod) EQ lCase(mod.name)>
|
||||
<cfset existingModName = isSimpleValue(existingMod) ? existingMod : (isStruct(existingMod) AND structKeyExists(existingMod, "name") ? existingMod.name : "")>
|
||||
<cfif len(existingModName) AND lCase(existingModName) EQ lCase(mod.name)>
|
||||
<cfset alreadyAssigned = true>
|
||||
<cfbreak>
|
||||
</cfif>
|
||||
|
|
|
|||
Reference in a new issue