fix
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
// V1ProcessItemScorecard scores one COMPLETED legacy process item against
|
||||
// OpenAPI LegacyProcessItem + A1 poll expectations.
|
||||
// OpenAPI ProcessItem + A1 poll expectations.
|
||||
type V1ProcessItemScorecard struct {
|
||||
EAN string `json:"ean"`
|
||||
Status string `json:"status"`
|
||||
@@ -184,7 +184,7 @@ func ScoreV1ProcessCompletedItem(item V1ProcessJobItem, opts ScoreV1ProcessItemO
|
||||
return sc
|
||||
}
|
||||
|
||||
// EnforceV1ProcessCompletedItem fills LegacyProcessItem projection gaps for a successful item:
|
||||
// EnforceV1ProcessCompletedItem fills ProcessItem projection gaps for a successful item:
|
||||
// nonempty description when title exists (formula HTML preserved), readable title spacing,
|
||||
// category display name as primary, optional SEO meta (unless omitSEOMeta), clean attrs.
|
||||
// allowed is the company attribute_key set (canonicalized). When nil, only
|
||||
@@ -209,6 +209,7 @@ func EnforceV1ProcessCompletedItemOpts(item V1ProcessJobItem, opts EnforceV1Opts
|
||||
if item == nil {
|
||||
return item
|
||||
}
|
||||
stripV1ProcessItemInternalKeys(item)
|
||||
status, _ := item["status"].(string)
|
||||
if status != "processed" {
|
||||
return item
|
||||
@@ -230,6 +231,9 @@ func EnforceV1ProcessCompletedItemOpts(item V1ProcessJobItem, opts EnforceV1Opts
|
||||
if title == "" {
|
||||
title = ensureReadableTitleSpacing(stringFromItem(item, "title"))
|
||||
}
|
||||
if isPromptLabelTitle(title) {
|
||||
title = preferredProductTitle(stringFromItem(item, "ean"), title)
|
||||
}
|
||||
if title != "" {
|
||||
item["name"] = title
|
||||
delete(item, "title")
|
||||
@@ -237,9 +241,6 @@ func EnforceV1ProcessCompletedItemOpts(item V1ProcessJobItem, opts EnforceV1Opts
|
||||
item["name"] = nil
|
||||
delete(item, "title")
|
||||
}
|
||||
delete(item, "id")
|
||||
delete(item, "processed_product_id")
|
||||
delete(item, "raw_product_id")
|
||||
|
||||
catID, catName := projectV1CategoryFields(item)
|
||||
catLabel := catName
|
||||
@@ -248,6 +249,9 @@ func EnforceV1ProcessCompletedItemOpts(item V1ProcessJobItem, opts EnforceV1Opts
|
||||
}
|
||||
|
||||
desc, _ := descriptionFromItem(item)
|
||||
if isPromptLeakageTitle(desc) || isPromptLabelTitle(desc) {
|
||||
desc = ""
|
||||
}
|
||||
needsDesc := title != "" && (desc == "" ||
|
||||
isWeakPriorEnhanceDescription(desc, title) ||
|
||||
descriptionEchoesTitle(desc, title) ||
|
||||
|
||||
Reference in New Issue
Block a user