fix: D(도즈) 단위는 boxes=units로 처리 (나잘스프레이 등)

This commit is contained in:
thug0bin
2026-03-07 17:49:03 +09:00
parent dc2a992c12
commit 0f69b50c49
3 changed files with 65 additions and 6 deletions

View File

@@ -600,15 +600,19 @@ def api_geoyoung_orders_by_kd():
"""
규격에서 수량 추출 (30T → 30, 100C → 100)
우선순위:
1. spec에서 T/C/P/D 단위 숫자 (예: 14T → 14)
2. product_name에서 T/C/P/D 단위 숫자
3. spec의 첫 번째 숫자 (fallback)
단위 처리:
- T/C/P: 정/캡슐/포 → 숫자 그대로 (30T → 30)
- D: 도즈/분사 → 1로 처리 (140D → 1, 박스 단위)
- mg/ml/g: 용량 → 1로 처리
"""
combined = f"{spec} {product_name}"
# T/C/P/D 단위가 붙은 숫자 우선 추출 (예: 14T, 100C, 30P, 140D)
qty_match = re.search(r'(\d+)\s*[TCPD]\b', combined, re.IGNORECASE)
# D(도즈) 단위는 박스 단위로 계산 (140D → 1)
if re.search(r'\d+\s*D\b', combined, re.IGNORECASE):
return 1
# T/C/P 단위가 붙은 숫자 추출 (예: 14T, 100C, 30P)
qty_match = re.search(r'(\d+)\s*[TCP]\b', combined, re.IGNORECASE)
if qty_match:
return int(qty_match.group(1))