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:
@@ -269,11 +269,14 @@ def list_machines(user=Depends(can('view'))):
|
||||
def create_machine(body: MachineIn, user=Depends(can('users'))):
|
||||
mid = uuid4()
|
||||
with db.connect() as c:
|
||||
if c.execute('SELECT 1 FROM dtf_local.machines WHERE lower(name)=lower(%s)', (body.name.strip(),)).fetchone():
|
||||
raise HTTPException(409, 'Já existe uma máquina com este nome.')
|
||||
c.execute('''INSERT INTO dtf_local.machines(id,name,products,active,limit_metres,places)
|
||||
VALUES(%s,%s,%s,%s,%s,%s)''', (mid, body.name.strip(), sorted(set(body.products)), body.active,
|
||||
body.limit_metres, body.places or machines.DEFAULT_PLACES))
|
||||
# A machine's hot folder is its first name, for good: no other machine
|
||||
# may be called that, or two would share one folder.
|
||||
if c.execute('SELECT 1 FROM dtf_local.machines WHERE lower(name)=lower(%s) OR lower(folder)=lower(%s)',
|
||||
(body.name.strip(), body.name.strip())).fetchone():
|
||||
raise HTTPException(409, 'Já existe uma máquina, ou a pasta de uma máquina, com este nome.')
|
||||
c.execute('''INSERT INTO dtf_local.machines(id,name,folder,products,active,limit_metres,places)
|
||||
VALUES(%s,%s,%s,%s,%s,%s,%s)''', (mid, body.name.strip(), body.name.strip(), sorted(set(body.products)),
|
||||
body.active, body.limit_metres, body.places or machines.DEFAULT_PLACES))
|
||||
audit('machine_created', operator=user, machine=body.name)
|
||||
return {'id': str(mid)}
|
||||
|
||||
@@ -281,9 +284,9 @@ def create_machine(body: MachineIn, user=Depends(can('users'))):
|
||||
@router.post('/api/operator/machines/{mid}')
|
||||
def update_machine(mid: UUID, body: MachineIn, user=Depends(can('users'))):
|
||||
with db.connect() as c:
|
||||
if c.execute('SELECT 1 FROM dtf_local.machines WHERE lower(name)=lower(%s) AND id<>%s',
|
||||
(body.name.strip(), mid)).fetchone():
|
||||
raise HTTPException(409, 'Já existe uma máquina com este nome.')
|
||||
if c.execute('''SELECT 1 FROM dtf_local.machines WHERE (lower(name)=lower(%s) OR lower(folder)=lower(%s))
|
||||
AND id<>%s''', (body.name.strip(), body.name.strip(), mid)).fetchone():
|
||||
raise HTTPException(409, 'Já existe uma máquina, ou a pasta de uma máquina, com este nome.')
|
||||
if not c.execute('''UPDATE dtf_local.machines SET name=%s,products=%s,active=%s,limit_metres=%s,
|
||||
places=COALESCE(%s,places) WHERE id=%s RETURNING id''',
|
||||
(body.name.strip(), sorted(set(body.products)), body.active, body.limit_metres,
|
||||
|
||||
Reference in New Issue
Block a user