Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1167,6 +1167,25 @@ func productSeriesResolvePGVariant(ctx context.Context, pg *sql.DB, productCode,
|
||||
}
|
||||
dim3ID = sql.NullInt64{Int64: id, Valid: true}
|
||||
}
|
||||
|
||||
// Only treat variants as ready if they exist in authoritative item-dim combos.
|
||||
// This prevents writing series assignments for stock variants that don't exist on the PG side.
|
||||
dim3Key := int64(0)
|
||||
if dim3ID.Valid {
|
||||
dim3Key = dim3ID.Int64
|
||||
}
|
||||
var exists int
|
||||
if err := pg.QueryRowContext(ctx, `
|
||||
SELECT 1
|
||||
FROM mk_mmitem_dim_combo
|
||||
WHERE product_code=$1 AND dim1=$2 AND dim3_key=$3
|
||||
LIMIT 1
|
||||
`, strings.TrimSpace(productCode), dim1ID, dim3Key).Scan(&exists); err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return 0, 0, sql.NullInt64{}, false, nil
|
||||
}
|
||||
return 0, 0, sql.NullInt64{}, false, err
|
||||
}
|
||||
return mmitemID, dim1ID, dim3ID, true, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user