From 57851abffc4072bb59439f433b12ed75180d2765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Thu, 12 Nov 2026 11:25:09 -0300 Subject: [PATCH] fix: the designer's extra hours come from the order's own record designer_hours ignored the hours stored with the order's treatment; an order keeps the hours it was sold with, 48/24 only when none are recorded. Co-Authored-By: Claude Opus 5.5 (1M context) --- app/cart_pricing.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/cart_pricing.py b/app/cart_pricing.py index c672f53..1bcc8a3 100644 --- a/app/cart_pricing.py +++ b/app/cart_pricing.py @@ -59,11 +59,11 @@ def redesign_price(items, choice, offer): def designer_hours(snapshot): """The extra hours the paid designer work adds to the deadline: 48 h when any art was sent to Redesenho, else 24 h for the basic Ajuste Fino.""" - if snapshot.get('redesign'): - return 48 - if snapshot.get('treatment'): - return 24 - return 0 + # The hours recorded with the order win (an order keeps what it was sold + # with); 48 and 24 are the defaults for snapshots that carry none. + hours = [int((snapshot[key] if isinstance(snapshot.get(key), dict) else {}).get('hours') or default) + for key, default in (('redesign', 48), ('treatment', 24)) if snapshot.get(key)] + return max(hours, default=0) def needs_designer(snapshot):