From 13c9df1e9685c28010b936dae04d4bcc06eea69a Mon Sep 17 00:00:00 2001 From: M_Kececi Date: Fri, 19 Jun 2026 13:56:21 +0300 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- svc/routes/wholesale_campaigns.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/svc/routes/wholesale_campaigns.go b/svc/routes/wholesale_campaigns.go index a7fd113..e31a1e9 100644 --- a/svc/routes/wholesale_campaigns.go +++ b/svc/routes/wholesale_campaigns.go @@ -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)