fix: a cancelled order takes its open proof card, a renamed machine keeps its hot folder, a film is approved with all its parts
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 8m8s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m11s
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 8m8s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m11s
- Cancelling an order left its proof card not yet answered on the board, where it could still be pulled and printed. It is cancelled with it. - The hot folder path was the machine's current name, so renaming a machine sent its next files to a folder FlexiPRINT does not watch. Each machine now keeps the folder it was created with (migration fills it with today's names); no other machine may take that name, and the machine form shows the folder. - A final set with only some parts of a film was accepted, the #130 failure through the manual path. The server now refuses it and names the parts missing. - The proof card note says up to 30 cm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,20 @@ def submit_files(c, order, body, identity, kind, actor):
|
||||
current = {(row['upload_id'], row['item_index']) for row in c.execute(
|
||||
"SELECT upload_id,item_index FROM dtf_local.order_files WHERE order_id=%s AND kind='final' AND active",
|
||||
(order['id'],)).fetchall()} if kind == 'final' else set()
|
||||
# A film in parts is approved whole: with only some of its parts, the
|
||||
# others never reach the folders or the machine (#114, #128, #130).
|
||||
if kind == 'final':
|
||||
sent = {}
|
||||
for ref in body.files:
|
||||
sent.setdefault(ref.item_index, set()).add(str(ref.upload_id))
|
||||
for row in c.execute('''SELECT item_index, array_agg(upload_id::text ORDER BY part) AS uploads,
|
||||
array_agg(part ORDER BY part) AS numbers FROM dtf_local.print_parts WHERE order_id=%s
|
||||
GROUP BY item_index HAVING count(*) > 1''', (order['id'],)).fetchall():
|
||||
mine = sent.get(row['item_index'], set())
|
||||
missing = [n for n, u in zip(row['numbers'], row['uploads']) if u not in mine]
|
||||
if mine & set(row['uploads']) and missing:
|
||||
raise HTTPException(422, f"O filme do item {row['item_index'] + 1} tem {len(row['uploads'])} partes: "
|
||||
f"envie todas (faltam {', '.join('p' + str(n) for n in missing)}).")
|
||||
kept = {ref.upload_id for ref in body.files if (ref.upload_id, ref.item_index) in current}
|
||||
if kept and len(kept) == len(body.files):
|
||||
raise HTTPException(409, 'Estes já são os arquivos finais. Envie o arquivo novo.')
|
||||
|
||||
Reference in New Issue
Block a user