Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -997,7 +997,7 @@ LIMIT 1
|
||||
if token == "" || id <= 0 {
|
||||
continue
|
||||
}
|
||||
key := column + "|" + token
|
||||
key := fmt.Sprintf("%s|%d|%s", column, itemID, token)
|
||||
if _, exists := out[key]; !exists {
|
||||
out[key] = id
|
||||
}
|
||||
@@ -1070,18 +1070,18 @@ DO UPDATE SET dim_id = EXCLUDED.dim_id, updated_at = EXCLUDED.updated_at
|
||||
|
||||
inferredDim1 := buildInferredMap("dimval1", colorTokensByItem, itemDim1Candidates)
|
||||
inferredDim3 := buildInferredMap("dimval3", dim3TokensByItem, itemDim3Candidates)
|
||||
resolveProductDimID := func(column string, token string, inferred map[string]int64) (int64, bool) {
|
||||
if id, ok := resolveDimID(column, token); ok {
|
||||
return id, true
|
||||
}
|
||||
resolveProductDimID := func(itemID int64, column string, token string, inferred map[string]int64) (int64, bool) {
|
||||
token = strings.ToUpper(normalizeDimParam(token))
|
||||
if token == "" {
|
||||
return 0, false
|
||||
}
|
||||
if id := inferred[column+"|"+token]; id > 0 {
|
||||
if id := inferred[fmt.Sprintf("%s|%d|%s", column, itemID, token)]; id > 0 {
|
||||
persistDimToken(column, token, id)
|
||||
return id, true
|
||||
}
|
||||
if id, ok := resolveDimID(column, token); ok {
|
||||
return id, true
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
@@ -1099,14 +1099,14 @@ DO UPDATE SET dim_id = EXCLUDED.dim_id, updated_at = EXCLUDED.updated_at
|
||||
// Map Nebim tokens to PG integer ids. Color and yaka must use separate token namespaces,
|
||||
// because the same visible token (for example "001") can exist in both dimensions.
|
||||
d1 := int64(0)
|
||||
if id, ok := resolveProductDimID("dimval1", colorCode, inferredDim1); ok {
|
||||
if id, ok := resolveProductDimID(itemID, "dimval1", colorCode, inferredDim1); ok {
|
||||
d1 = id
|
||||
}
|
||||
if d1 <= 0 {
|
||||
continue
|
||||
}
|
||||
d3k := int64(0)
|
||||
if id, ok := resolveProductDimID("dimval3", dim3Code, inferredDim3); ok {
|
||||
if id, ok := resolveProductDimID(itemID, "dimval3", dim3Code, inferredDim3); ok {
|
||||
d3k = id
|
||||
}
|
||||
key := fmt.Sprintf("%d|%d|%d", itemID, d1, d3k)
|
||||
@@ -1119,7 +1119,7 @@ DO UPDATE SET dim_id = EXCLUDED.dim_id, updated_at = EXCLUDED.updated_at
|
||||
v2 = sizeID
|
||||
}
|
||||
v3 := int64(0)
|
||||
if id, ok := resolveProductDimID("dimval3", dim3Code, inferredDim3); ok {
|
||||
if id, ok := resolveProductDimID(itemID, "dimval3", dim3Code, inferredDim3); ok {
|
||||
v3 = id
|
||||
}
|
||||
mmdimID := int64(2)
|
||||
|
||||
Reference in New Issue
Block a user