fix: a transfer asks which part the new machine resumes from and names the old machine's .prt to delete (Marcus, 2026-12-01)

The hot folder takes a PNG in about 10 s and the Hoson queues it, so the
last part taken is not the one being ripped. The dialog lists the parts
(already taken or still in the folder) and asks where to resume once any
was taken; the new round starts there, and the parts from there on that
the old machine took are named as Hoson .prt files to delete, in the
toast, the card and the history. The film card no longer claims which part
prints: '2/3 partes com a máquina'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-01 09:39:58 -03:00
parent ea05ba6a31
commit 41e905555b
7 changed files with 111 additions and 38 deletions

View File

@@ -220,10 +220,12 @@ def with_print_files(c, orders):
previews = c.execute('''SELECT order_id,number,sent_at,sent_by,decided_at,result,reason,decided_by
FROM dtf_local.redesign_previews WHERE order_id=ANY(%s) ORDER BY order_id,number''', (ids,)).fetchall()
# Each order's machine transfers, oldest first (Rodada 5, D4).
transfers = c.execute('''SELECT order_id,from_name,to_name,reason,resumed_from,created_by,created_at
transfers = c.execute('''SELECT order_id,from_name,to_name,reason,resumed_from,delete_prt,created_by,created_at
FROM dtf_local.machine_transfers WHERE order_id=ANY(%s) ORDER BY id''', (ids,)).fetchall()
# Where a printing order's files are in its machine's hot folder (item 10).
hot = hotfolder.progress(c, [o['id'] for o in orders if o['state'] == 'imp'])
# Each printing order's parts, for the transfer dialog's "Recomeçar da parte" (D4).
hot_parts = hotfolder.last_round(c, [o['id'] for o in orders if o['state'] == 'imp'])
# Orders the machine already printed: a reprint chooses which items go
# again (#105), the ones whose final changed suggested.
taken = hotfolder.printed(c, [o['id'] for o in orders if o['state'] in ('rec', 'tra', 'cor')])
@@ -241,6 +243,7 @@ def with_print_files(c, orders):
proof_reviews = reviews.by_order(c, [r['id'] for r in children.values()])
for order in orders:
order['hot'] = hot.get(order['id'])
order['hot_parts'] = hot_parts.get(order['id'], [])
order['reviews'] = review_rows.get(str(order['id']), [])
child = children.get(order['id'])
# Its machine: an order prints where its approved proof did (Dropstar, 2026-11-05).
@@ -278,7 +281,7 @@ def with_print_files(c, orders):
'reason', 'decided_by')}
for row in previews if row['order_id'] == order['id']]
order['transfers'] = [{k: row[k] for k in ('from_name', 'to_name', 'reason', 'resumed_from',
'created_by', 'created_at')}
'delete_prt', 'created_by', 'created_at')}
for row in transfers if row['order_id'] == order['id']]
return assign_machines(c, orders)