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):