Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -997,7 +997,7 @@ LIMIT 1
|
|||||||
if token == "" || id <= 0 {
|
if token == "" || id <= 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
key := column + "|" + token
|
key := fmt.Sprintf("%s|%d|%s", column, itemID, token)
|
||||||
if _, exists := out[key]; !exists {
|
if _, exists := out[key]; !exists {
|
||||||
out[key] = id
|
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)
|
inferredDim1 := buildInferredMap("dimval1", colorTokensByItem, itemDim1Candidates)
|
||||||
inferredDim3 := buildInferredMap("dimval3", dim3TokensByItem, itemDim3Candidates)
|
inferredDim3 := buildInferredMap("dimval3", dim3TokensByItem, itemDim3Candidates)
|
||||||
resolveProductDimID := func(column string, token string, inferred map[string]int64) (int64, bool) {
|
resolveProductDimID := func(itemID int64, column string, token string, inferred map[string]int64) (int64, bool) {
|
||||||
if id, ok := resolveDimID(column, token); ok {
|
|
||||||
return id, true
|
|
||||||
}
|
|
||||||
token = strings.ToUpper(normalizeDimParam(token))
|
token = strings.ToUpper(normalizeDimParam(token))
|
||||||
if token == "" {
|
if token == "" {
|
||||||
return 0, false
|
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)
|
persistDimToken(column, token, id)
|
||||||
return id, true
|
return id, true
|
||||||
}
|
}
|
||||||
|
if id, ok := resolveDimID(column, token); ok {
|
||||||
|
return id, true
|
||||||
|
}
|
||||||
return 0, false
|
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,
|
// 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.
|
// because the same visible token (for example "001") can exist in both dimensions.
|
||||||
d1 := int64(0)
|
d1 := int64(0)
|
||||||
if id, ok := resolveProductDimID("dimval1", colorCode, inferredDim1); ok {
|
if id, ok := resolveProductDimID(itemID, "dimval1", colorCode, inferredDim1); ok {
|
||||||
d1 = id
|
d1 = id
|
||||||
}
|
}
|
||||||
if d1 <= 0 {
|
if d1 <= 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
d3k := int64(0)
|
d3k := int64(0)
|
||||||
if id, ok := resolveProductDimID("dimval3", dim3Code, inferredDim3); ok {
|
if id, ok := resolveProductDimID(itemID, "dimval3", dim3Code, inferredDim3); ok {
|
||||||
d3k = id
|
d3k = id
|
||||||
}
|
}
|
||||||
key := fmt.Sprintf("%d|%d|%d", itemID, d1, d3k)
|
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
|
v2 = sizeID
|
||||||
}
|
}
|
||||||
v3 := int64(0)
|
v3 := int64(0)
|
||||||
if id, ok := resolveProductDimID("dimval3", dim3Code, inferredDim3); ok {
|
if id, ok := resolveProductDimID(itemID, "dimval3", dim3Code, inferredDim3); ok {
|
||||||
v3 = id
|
v3 = id
|
||||||
}
|
}
|
||||||
mmdimID := int64(2)
|
mmdimID := int64(2)
|
||||||
|
|||||||
Reference in New Issue
Block a user