Merge Ajuste Fino: priced per art, offered under the Prumo warnings
All checks were successful
Build and deploy / Validate source (push) Successful in 12s
Build and deploy / Integration suite on a real stack (push) Successful in 6m58s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 1m38s
All checks were successful
Build and deploy / Validate source (push) Successful in 12s
Build and deploy / Integration suite on a real stack (push) Successful in 6m58s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 1m38s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,8 +47,12 @@ def session(request: Request, response: Response):
|
||||
'password_recovery': mail.configured(),
|
||||
# Per metre on a finished sheet someone opens by hand (app/core/pricing.py).
|
||||
'manual_extra_cents': manual_extra_cents(),
|
||||
# Zero keeps the designer's treatment hidden, as an off product does.
|
||||
# Zero keeps Ajuste Fino hidden, as an off product does. Its bands
|
||||
# are counted in arts, not metres.
|
||||
'treatment_cents': treatment['unit_cents'] if treatment['enabled'] else 0,
|
||||
'treatment_bands': [{'from_metres': float(band['from_metres']),
|
||||
'unit_cents': band['unit_cents']}
|
||||
for band in treatment['bands']] if treatment['enabled'] else [],
|
||||
# The grade rules the Site needs for the treatment requirement
|
||||
# (front 8.5): {} when nothing is configured.
|
||||
'grade_rules': rules,
|
||||
|
||||
@@ -501,7 +501,7 @@ def move(uid: UUID, body: Move, request: Request, user=Depends(operator)):
|
||||
JOIN dtf_local.uploads u ON u.id=f.upload_id
|
||||
WHERE f.order_id=%s AND {FINAL_OK} AND {TREATED}''', (uid,)).fetchall()
|
||||
if {r['item_index'] for r in treated} != set(range(len(row['snapshot']['items']))):
|
||||
raise HTTPException(409, 'Tratamento pago: envie e aprove a arte tratada de todos os itens antes de entrar na fila.')
|
||||
raise HTTPException(409, 'Ajuste Fino pago: envie e aprove a arte do Ajuste Fino de todos os itens antes de entrar na fila.')
|
||||
# Two at most per machine in Imprimindo (app/machines.py).
|
||||
if body.state == 'imp' and (name := machines.full(c, row['machine_id'], uid)):
|
||||
raise HTTPException(409, f'{name} já tem {machines.PRINTING_CAP} em Imprimindo.')
|
||||
|
||||
@@ -29,21 +29,20 @@ def price_row(row):
|
||||
|
||||
|
||||
def checked_bands(product, bands):
|
||||
"""The bands the row will store; 422 in Portuguese for anything invalid."""
|
||||
if product == 'tratamento' and bands:
|
||||
raise HTTPException(422, 'O tratamento é um valor por pedido: não tem faixas.')
|
||||
"""The bands the row will store; 422 in Portuguese for anything invalid.
|
||||
Ajuste Fino counts its bands in arts; the other products in metres."""
|
||||
if len(bands) > 5:
|
||||
raise HTTPException(422, 'Um preço pode ter no máximo 5 faixas.')
|
||||
checked, last = [], None
|
||||
for band in bands:
|
||||
if not band.from_metres.is_finite() or band.from_metres <= 0:
|
||||
raise HTTPException(422, 'A metragem de cada faixa precisa ser maior que zero.')
|
||||
raise HTTPException(422, 'O início de cada faixa precisa ser maior que zero.')
|
||||
if band.unit_cents <= 0:
|
||||
raise HTTPException(422, 'O preço de cada faixa precisa ser maior que zero.')
|
||||
if band.unit_cents > 10000000:
|
||||
raise HTTPException(422, 'O preço de cada faixa é alto demais.')
|
||||
if last is not None and band.from_metres <= last:
|
||||
raise HTTPException(422, 'As faixas precisam estar em ordem crescente de metragem.')
|
||||
raise HTTPException(422, 'As faixas precisam estar em ordem crescente.')
|
||||
last = band.from_metres
|
||||
checked.append({'from_metres': str(band.from_metres), 'unit_cents': band.unit_cents})
|
||||
return checked
|
||||
@@ -247,7 +246,7 @@ def site_grade_rules(user=Depends(can('manage'))):
|
||||
@router.post('/api/operator/site/grade-rules')
|
||||
def save_grade_rules(body: GradeRules, user=Depends(can('manage'))):
|
||||
if body.aviso is not None and body.tratamento is not None and body.tratamento > body.aviso:
|
||||
raise HTTPException(422, 'A regra do tratamento precisa ser menor ou igual à do aviso.')
|
||||
raise HTTPException(422, 'A regra do Ajuste Fino precisa ser menor ou igual à do aviso.')
|
||||
with db.connect() as c:
|
||||
for action, below in (('aviso', body.aviso), ('tratamento', body.tratamento)):
|
||||
if below is None:
|
||||
|
||||
Reference in New Issue
Block a user