Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-06-23 21:00:22 +03:00
parent 057f52a1f9
commit 8b97e26d70

View File

@@ -695,14 +695,20 @@ ORDER BY d.id, r.priority DESC, r.id
} }
out := make([]productSeriesAutoRule, 0, len(byID)) out := make([]productSeriesAutoRule, 0, len(byID))
for _, r := range 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, "-") { for _, part := range strings.Split(r.Title, "-") {
size := normalizeProductSeriesSize(part) size := normalizeProductSeriesSize(part)
if size != "" { if size == "" {
continue
}
if _, ok := r.Ratio[size]; ok {
continue
}
r.Ratio[size] = 1 r.Ratio[size] = 1
} }
}
}
if len(r.Ratio) > 0 { if len(r.Ratio) > 0 {
out = append(out, *r) out = append(out, *r)
} }