From 8b97e26d702c84d6fb9b7db2f85860c40b3da6d5 Mon Sep 17 00:00:00 2001 From: M_Kececi Date: Tue, 23 Jun 2026 21:00:22 +0300 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- svc/product_series_auto_scheduler.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/svc/product_series_auto_scheduler.go b/svc/product_series_auto_scheduler.go index cd44224..e888fce 100644 --- a/svc/product_series_auto_scheduler.go +++ b/svc/product_series_auto_scheduler.go @@ -695,13 +695,19 @@ ORDER BY d.id, r.priority DESC, r.id } out := make([]productSeriesAutoRule, 0, len(byID)) for _, r := range byID { - if len(r.Ratio) == 0 { - for _, part := range strings.Split(r.Title, "-") { - size := normalizeProductSeriesSize(part) - if size != "" { - r.Ratio[size] = 1 - } + // 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 == "" { + continue } + if _, ok := r.Ratio[size]; ok { + continue + } + r.Ratio[size] = 1 } if len(r.Ratio) > 0 { out = append(out, *r)