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) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-12 11:25:09 -03:00
parent 461bd6bbcc
commit 57851abffc

View File

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