fix
This commit is contained in:
@@ -63,11 +63,17 @@ func ScoreV1ProcessCompletedItem(item V1ProcessJobItem, opts ScoreV1ProcessItemO
|
||||
return sc
|
||||
}
|
||||
|
||||
title := stringFromItem(item, "title")
|
||||
title := stringFromItem(item, "name")
|
||||
if title == "" {
|
||||
title = stringFromItem(item, "title")
|
||||
}
|
||||
name := stringFromItem(item, "name")
|
||||
if name == "" {
|
||||
name = title
|
||||
}
|
||||
sc.HasTitle = title != ""
|
||||
sc.HasName = name != ""
|
||||
if sc.HasTitle && !sc.HasName {
|
||||
if !sc.HasName && sc.HasTitle {
|
||||
sc.FailFlags = append(sc.FailFlags, "missing_name")
|
||||
}
|
||||
if sc.HasTitle && sc.HasName && title != name {
|
||||
@@ -140,22 +146,8 @@ func ScoreV1ProcessCompletedItem(item V1ProcessJobItem, opts ScoreV1ProcessItemO
|
||||
sc.FailFlags = append(sc.FailFlags, "eprel_invalid_shape")
|
||||
}
|
||||
|
||||
id := stringFromItem(item, "id")
|
||||
ppID := stringFromItem(item, "processed_product_id")
|
||||
rawID := stringFromItem(item, "raw_product_id")
|
||||
sc.HasIDs = id != "" && ppID != "" && rawID != ""
|
||||
if id == "" {
|
||||
sc.FailFlags = append(sc.FailFlags, "missing_id")
|
||||
}
|
||||
if ppID == "" {
|
||||
sc.FailFlags = append(sc.FailFlags, "missing_processed_product_id")
|
||||
}
|
||||
if rawID == "" {
|
||||
sc.FailFlags = append(sc.FailFlags, "missing_raw_product_id")
|
||||
}
|
||||
if id != "" && ppID != "" && id != ppID {
|
||||
sc.FailFlags = append(sc.FailFlags, "id_processed_product_id_mismatch")
|
||||
}
|
||||
// Internal UUIDs are omitted from the public V1 process item shape.
|
||||
sc.HasIDs = true
|
||||
|
||||
sc.ImagesOK = imageFieldsOK(item)
|
||||
if !sc.ImagesOK {
|
||||
@@ -234,14 +226,20 @@ func EnforceV1ProcessCompletedItemOpts(item V1ProcessJobItem, opts EnforceV1Opts
|
||||
item["attributes"] = nil
|
||||
}
|
||||
|
||||
title := ensureReadableTitleSpacing(stringFromItem(item, "title"))
|
||||
if title != "" {
|
||||
item["title"] = title
|
||||
item["name"] = title
|
||||
} else {
|
||||
item["title"] = nil
|
||||
item["name"] = nil
|
||||
title := ensureReadableTitleSpacing(stringFromItem(item, "name"))
|
||||
if title == "" {
|
||||
title = ensureReadableTitleSpacing(stringFromItem(item, "title"))
|
||||
}
|
||||
if title != "" {
|
||||
item["name"] = title
|
||||
delete(item, "title")
|
||||
} else {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user