feat: a reprint sends only the items chosen to the machine (Marcus, 2026-11-26, #105)
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 7m55s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m34s
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 7m55s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m34s
An order the machine already printed, back in Arte conferida, sends again only the items whose final changed since the machine took them; the panel's "Vai para a máquina" shows and changes the choice, and the card says "Reimpressão". The order stays one card. The pass to Revisão keeps the items printed, so the machine's metres count only those. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,7 +61,7 @@ def one_decimal(value):
|
||||
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 FROM dtf_local.movements m
|
||||
rows = c.execute('''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
|
||||
AND (%s::timestamptz IS NULL OR m.created_at > %s::timestamptz)''',
|
||||
@@ -70,7 +70,10 @@ def printed_since(c, machine_id, since):
|
||||
for row in rows:
|
||||
snapshot = row['snapshot'] or {}
|
||||
proof = bool(snapshot.get('proof_of'))
|
||||
for item in snapshot.get('items') or []:
|
||||
for index, item in enumerate(snapshot.get('items') or []):
|
||||
# A reprint counts only the items that went again (#105).
|
||||
if row.get('items') is not None and index not in row['items']:
|
||||
continue
|
||||
if proof:
|
||||
total += PROOF_SHEET_CM
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user