Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -695,14 +695,20 @@ ORDER BY d.id, r.priority DESC, r.id
|
||||
}
|
||||
out := make([]productSeriesAutoRule, 0, len(byID))
|
||||
for _, r := range byID {
|
||||
if len(r.Ratio) == 0 {
|
||||
// Always augment ratio map from the dfgrp.title tokens.
|
||||
// mk_product_series_rule can be partially populated (or manually edited), which would allow
|
||||
// a "subset" rule (e.g. only M+XL) to match stock and incorrectly assign a series like
|
||||
// "XS-S-M-L-XL-2XL". Title tokens are the canonical definition of a series in this setup.
|
||||
for _, part := range strings.Split(r.Title, "-") {
|
||||
size := normalizeProductSeriesSize(part)
|
||||
if size != "" {
|
||||
if size == "" {
|
||||
continue
|
||||
}
|
||||
if _, ok := r.Ratio[size]; ok {
|
||||
continue
|
||||
}
|
||||
r.Ratio[size] = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(r.Ratio) > 0 {
|
||||
out = append(out, *r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user