fix: a film's parts go to the machine in their own order, p2 before p10
Some checks failed
Some checks failed
The hot folder and the folders' list ordered the parts by name, so a film of ten parts or more (#81, 91,5 m) would send p10 second. They now follow the part number. Checked on Postgres 17 with an 11-part film. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -54,11 +54,15 @@ def start(c, order_id):
|
||||
"""The order entered Imprimindo: its approved finals queue for its
|
||||
machine's folder, item by item, part by part; on a reprint only the items
|
||||
chosen to go again (orders.print_items)."""
|
||||
# A film's parts in their own order, p2 before p10: by name, a 91 m film
|
||||
# would print p10 second.
|
||||
files = c.execute('''SELECT f.item_index, f.upload_id, u.name FROM dtf_local.order_files f
|
||||
JOIN dtf_local.uploads u ON u.id=f.upload_id JOIN dtf_local.orders o ON o.id=f.order_id
|
||||
LEFT JOIN dtf_local.print_parts pp ON pp.order_id=f.order_id AND pp.item_index=f.item_index
|
||||
AND pp.upload_id=f.upload_id
|
||||
WHERE f.order_id=%s AND f.kind='final' AND f.active
|
||||
AND (o.print_items IS NULL OR f.item_index = ANY(o.print_items))
|
||||
ORDER BY f.item_index, u.name''', (order_id,)).fetchall()
|
||||
ORDER BY f.item_index, pp.part NULLS LAST, length(u.name), u.name''', (order_id,)).fetchall()
|
||||
round_ = c.execute('SELECT COALESCE(max(round), 0) + 1 AS r FROM dtf_local.hot_parts WHERE order_id=%s',
|
||||
(order_id,)).fetchone()['r']
|
||||
for seq, row in enumerate(files, 1):
|
||||
|
||||
Reference in New Issue
Block a user