fix: a reprint keeps an all-items choice, an undone pass to Revisão prints nothing again, and Prova OK tells Tiny (#105)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 7m56s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m26s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 7m56s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m26s
- Every item ticked was saved as NULL, which also means "not chosen", so the pass to the queue replaced it with the suggestion and only the changed item went to the machine; the panel showed the suggestion again. The choice is now the whole list. - Undoing a pass to Revisão (back to Imprimindo) started a new round with every file, so FlexiPRINT printed the order again. It now writes back only what Flexi had not taken, and the reprint choice of that pass returns. A pass undone this way no longer counts its film twice in the machine's metres (machine log and Números). - An order entering the queue by Prova OK never sent Tiny's "Preparando envio". The stage's Tiny event is now one function, used by the move and by the Prova OK. Integration test follows the real moves: suggestion, all items kept, pull onto a machine, two undone passes to Revisão, metres counted once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -58,12 +58,20 @@ def one_decimal(value):
|
||||
return f'{Decimal(str(value)):.1f}'.replace('.', ',')
|
||||
|
||||
|
||||
# A pass to Revisão undone at once (a mistaken move, back to Imprimindo):
|
||||
# the pass after the undo counts the film, so this one must not, or the
|
||||
# machine's metres count it twice. `m` is the pass in dtf_local.movements.
|
||||
NOT_UNDONE = """NOT EXISTS (SELECT 1 FROM dtf_local.movements u WHERE u.order_id=m.order_id AND u.back
|
||||
AND u.from_state='rev' AND u.to_state='imp'
|
||||
AND u.id=(SELECT min(n.id) FROM dtf_local.movements n WHERE n.order_id=m.order_id AND n.id>m.id))"""
|
||||
|
||||
|
||||
def printed_since(c, machine_id, since):
|
||||
"""Film metres the machine printed after `since` (None: ever), as Decimal."""
|
||||
from .proof import PROOF_SHEET_CM
|
||||
rows = c.execute('''SELECT o.snapshot, m.items FROM dtf_local.movements m
|
||||
rows = c.execute(f'''SELECT o.snapshot, m.items FROM dtf_local.movements m
|
||||
JOIN dtf_local.orders o ON o.id=m.order_id
|
||||
WHERE o.machine_id=%s AND m.from_state='imp' AND m.to_state='rev' AND NOT m.back
|
||||
WHERE o.machine_id=%s AND m.from_state='imp' AND m.to_state='rev' AND NOT m.back AND {NOT_UNDONE}
|
||||
AND (%s::timestamptz IS NULL OR m.created_at > %s::timestamptz)''',
|
||||
(machine_id, since, since)).fetchall()
|
||||
total = Decimal(0)
|
||||
|
||||
Reference in New Issue
Block a user