fix: Prova OK approves every part of a film, and "Gerar de novo" names the new files with a version (#114, #128, #130)
Some checks failed
Build and deploy / Validate source (push) Successful in 16s
Build and deploy / Publish images (push) Has been cancelled
Build and deploy / Integration suite on a real stack (push) Has been cancelled
Build and deploy / Secret scan and release gate (push) Has been cancelled
Some checks failed
Build and deploy / Validate source (push) Successful in 16s
Build and deploy / Publish images (push) Has been cancelled
Build and deploy / Integration suite on a real stack (push) Has been cancelled
Build and deploy / Secret scan and release gate (push) Has been cancelled
The proof's approval took the print file's first upload as the final, so the other parts of a film in parts never reached Arte conferida or the hot folder and were downloaded by hand. It now approves every part, and adds the missing ones to a first part already approved. A one-off migration completes the open orders still before Imprimindo. Generated again, the files are named DTF-130-v2-item-1-p2.png, as Marcus asked, so the FlexiPRINT queue and the Hoson list never take them for the first ones. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
23
app/proof.py
23
app/proof.py
@@ -123,14 +123,25 @@ def approve_parent(c, parent, operator):
|
||||
if not designer:
|
||||
generated = c.execute('''SELECT p.item_index,p.upload_id FROM dtf_local.print_files p
|
||||
WHERE p.order_id=%s AND p.status='ready' AND p.upload_id IS NOT NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM dtf_local.order_files f
|
||||
WHERE f.order_id=p.order_id AND f.item_index=p.item_index AND f.kind='final' AND f.active)
|
||||
ORDER BY p.item_index''', (parent['id'],)).fetchall()
|
||||
for row in generated:
|
||||
c.execute('''INSERT INTO dtf_local.order_files(id,order_id,upload_id,item_index,kind,note,created_by)
|
||||
VALUES(%s,%s,%s,%s,'final',%s,'Prumo')''',
|
||||
(uuid4(), parent['id'], row['upload_id'], row['item_index'],
|
||||
f'Aprovado pela prova do #{card["number"]}'))
|
||||
# Every part of a film in parts, not only its first: the others
|
||||
# never reached the folders (#114, #128, #130).
|
||||
parts = [r['upload_id'] for r in c.execute('''SELECT upload_id FROM dtf_local.print_parts
|
||||
WHERE order_id=%s AND item_index=%s ORDER BY part''', (parent['id'], row['item_index'])).fetchall()]
|
||||
parts = parts or [row['upload_id']]
|
||||
active = {r['upload_id'] for r in c.execute('''SELECT upload_id FROM dtf_local.order_files
|
||||
WHERE order_id=%s AND item_index=%s AND kind='final' AND active''',
|
||||
(parent['id'], row['item_index'])).fetchall()}
|
||||
# A final someone prepared or approved stays as it is.
|
||||
if active and not active <= set(parts):
|
||||
continue
|
||||
for upload_id in parts:
|
||||
if upload_id not in active:
|
||||
c.execute('''INSERT INTO dtf_local.order_files(id,order_id,upload_id,item_index,kind,note,created_by)
|
||||
VALUES(%s,%s,%s,%s,'final',%s,'Prumo')''',
|
||||
(uuid4(), parent['id'], upload_id, row['item_index'],
|
||||
f'Aprovado pela prova do #{card["number"]}'))
|
||||
treatment_clause = f'AND {TREATED}' if designer else ''
|
||||
ready = all(c.execute(f'''SELECT 1 FROM dtf_local.order_files f
|
||||
JOIN dtf_local.orders o ON o.id=f.order_id
|
||||
|
||||
Reference in New Issue
Block a user