Some checks failed
Build and deploy / Validate source (push) Successful in 4s
Build and deploy / Integration suite on a real stack (push) Failing after 1m17s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Has been skipped
B6: "12x nome.png" enters with 12 copies, art or ready sheet (up to 200; "1920x1080.png" is not read as copies). B3: the DPI refusal speaks per art, the cart and payment summaries list "Prova antes de imprimir" when chosen, and below 10 m the proof box stays, closed, saying the rule. D6: the Ajuste Fino refusal no longer shows the grade number (Site and server); the unused motivoNota helper is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.5 KiB
Python
36 lines
1.5 KiB
Python
"""What the art grade decides, set in the Kanban's Site tab (Fase 2, front 8.5).
|
|
|
|
With no rule nothing changes anywhere. An item triggers a rule when its grade
|
|
is below the rule's `below`; the order's worst item decides. `aviso` flags the
|
|
order for the designer; `tratamento` makes Ajuste Fino required, but only while
|
|
it is offered (enabled and priced above zero).
|
|
"""
|
|
|
|
|
|
def current_rules(c) -> dict:
|
|
"""{'aviso': 70, 'tratamento': 50} for the rows that exist."""
|
|
return {row['action']: row['below'] for row in
|
|
c.execute('SELECT action, below FROM dtf_local.grade_rules').fetchall()}
|
|
|
|
|
|
def triggered(rules: dict, items, treatment_offered: bool) -> dict:
|
|
"""The rules the order's worst item triggers: {'aviso': N}, maybe with
|
|
'tratamento': N. N is the worst grade; empty when no rule applies."""
|
|
grades = [item.get('grade') for item in items if item.get('grade') is not None]
|
|
if not grades:
|
|
return {}
|
|
worst = min(grades)
|
|
flags = {}
|
|
if 'aviso' in rules and worst < rules['aviso']:
|
|
flags['aviso'] = worst
|
|
if treatment_offered and 'tratamento' in rules and worst < rules['tratamento']:
|
|
flags['tratamento'] = worst
|
|
return flags
|
|
|
|
|
|
def treatment_message(grade: int) -> str:
|
|
"""The refusal the customer sees when Ajuste Fino is required. The grade
|
|
stays on the Kanban: the customer never sees the number (Rodada 5, D6)."""
|
|
return ('Sua arte está abaixo da resolução mínima, então o Ajuste Fino '
|
|
'é obrigatório neste pedido.')
|