diff --git a/svc/routes/wholesale_campaigns.go b/svc/routes/wholesale_campaigns.go index 9490bbb..a7fd113 100644 --- a/svc/routes/wholesale_campaigns.go +++ b/svc/routes/wholesale_campaigns.go @@ -984,10 +984,15 @@ LIMIT 1 for itemID, tokens := range tokenByItem { sortedTokens := sortTokens(tokens) sortedIDs := sortDimIDs(idsByItem[itemID]) - if len(sortedTokens) == 0 || len(sortedTokens) != len(sortedIDs) { + if len(sortedTokens) == 0 || len(sortedIDs) == 0 { continue } - for i, token := range sortedTokens { + limit := len(sortedTokens) + if len(sortedIDs) < limit { + limit = len(sortedIDs) + } + for i := 0; i < limit; i++ { + token := sortedTokens[i] id := sortedIDs[i] if token == "" || id <= 0 { continue