fix: the print file is written over twice as fast, and a file finished after Prova OK queues its order (#81)
Some checks failed
Build and deploy / Validate source (push) Successful in 1m41s
Build and deploy / Publish images (push) Has been cancelled
Build and deploy / Secret scan and release gate (push) Has been cancelled
Build and deploy / Integration suite on a real stack (push) Has been cancelled
Some checks failed
Build and deploy / Validate source (push) Successful in 1m41s
Build and deploy / Publish images (push) Has been cancelled
Build and deploy / Secret scan and release gate (push) Has been cancelled
Build and deploy / Integration suite on a real stack (push) Has been cancelled
#81's 91,5 m took 6 hours to generate. The PNG writer ran Pillow's row filters and then deflate at level 6; no filter at level 1 gives the same size in under half the time, for the file and the viewer's strips alike (1 m: 34 s -> 13 s). Its Prova OK came while the file was still being generated, so the order stayed in Arte recebida. The approval now also runs when the file finishes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ from fastapi import APIRouter, HTTPException
|
||||
|
||||
from ... import cnpj
|
||||
from ...core import db
|
||||
from ...finals import FINAL_OK, TREATED # noqa: F401 (the board, files and stats use them)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -40,20 +41,6 @@ def company_names(c, *groups):
|
||||
for rows in groups for row in rows])
|
||||
|
||||
|
||||
# An item's final counts while its file is still there and scanned clean: the
|
||||
# same rule that lets an order into the print queue.
|
||||
FINAL_OK = """f.kind='final' AND f.active AND u.expires_at>now() AND u.purged_at IS NULL AND u.scan_state='clean'"""
|
||||
# "Arte tratada" (Dropstar, 2026-10-27): a final someone prepared, not the
|
||||
# customer's own artwork. It is neither the file the system generated from
|
||||
# their art, nor one of their originals, nor a correction they sent. `f` is
|
||||
# the final in dtf_local.order_files, `o` its order.
|
||||
TREATED = """f.kind='final'
|
||||
AND NOT EXISTS (SELECT 1 FROM dtf_local.print_parts p WHERE p.order_id=f.order_id AND p.upload_id=f.upload_id)
|
||||
AND NOT EXISTS (SELECT 1 FROM jsonb_array_elements(o.snapshot->'items') i WHERE i->'uploads' ? f.upload_id::text)
|
||||
AND NOT EXISTS (SELECT 1 FROM dtf_local.order_files k WHERE k.order_id=f.order_id AND k.upload_id=f.upload_id
|
||||
AND k.kind='correction')"""
|
||||
|
||||
|
||||
def person(column):
|
||||
"""SQL: the team member's name for the e-mail in `column`, or the e-mail."""
|
||||
return f'COALESCE((SELECT op.name FROM dtf_local.operators op WHERE op.email={column}), {column})'
|
||||
|
||||
Reference in New Issue
Block a user