fix: the server refuses stacked pieces and files laid out at other proportions, and never cuts a strip with ink
Some checks failed
Build and deploy / Validate source (push) Successful in 5s
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 5s
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
The price came from the layout the browser sent, checked only in part: - Pieces on top of each other passed: 100 copies stacked in one place bill 10 cm and print over each other. The layout validator now refuses any overlap. - A file laid out at proportions it does not have (a 5 m sheet sent as 10 cm) was found only by the print file, after payment. The quote now checks each raster file's proportions from the bytes it already reads. - The empty strips the Site cuts from a ready sheet were cut on its word. The print file now reads them: a strip with ink sends the item to hand preparation with the reason, instead of printing the art cut off. Test fixtures that laid real images out at impossible proportions now keep the image's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -140,11 +140,15 @@ def review_photo(client, order_id):
|
||||
wait_scan(client,uid,operator=True)
|
||||
return client.call('/operator/orders/'+order_id+'/reviews',{'upload_id':uid},operator=True)
|
||||
|
||||
def item_spec(mode, metres, grade, uid):
|
||||
def item_spec(mode, metres, grade, uid, aspect=None):
|
||||
"""One file across the film, `metres` long. `aspect` (width / length) for
|
||||
a real image: the piece then keeps the file's proportions, as the server
|
||||
checks, inside the same billed length."""
|
||||
film_width=27 if mode in ('uvfile','uv') else 57
|
||||
length_cm=float(metres)*100
|
||||
height_cm=float(metres)*100
|
||||
length_cm=round(film_width/aspect,4) if aspect else height_cm
|
||||
return {'mode':mode,'metres':str(metres),'grade':grade,'uploads':[uid],
|
||||
'production':{'version':2,'film_width_cm':film_width,'height_cm':length_cm,
|
||||
'production':{'version':2,'film_width_cm':film_width,'height_cm':height_cm,
|
||||
'sources':[{'upload_id':uid,
|
||||
'kind':'sheet' if mode in ('file','uvfile','premium') else 'artwork',
|
||||
'width_cm':film_width,'length_cm':length_cm,'copies':1,
|
||||
@@ -249,10 +253,11 @@ def run():
|
||||
# A cart the Site priced is approved at once and can be paid straight away,
|
||||
# at the server's own prices; no operator can then change it.
|
||||
# The server works the grade out from the file: this PNG is 6059 px across
|
||||
# 57 cm, 270 DPI, which is grade 100 under the 200 DPI clean threshold.
|
||||
png=b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR'+(6059).to_bytes(4,'big')+(2000).to_bytes(4,'big')+b'\x08\x06\x00\x00\x00'+b'\x00'*4
|
||||
# 57 cm, 270 DPI, which is grade 100 under the 200 DPI clean threshold;
|
||||
# 29232 px long, the 275 cm it is laid out at (the server checks it).
|
||||
png=b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR'+(6059).to_bytes(4,'big')+(29232).to_bytes(4,'big')+b'\x08\x06\x00\x00\x00'+b'\x00'*4
|
||||
graded=upload_bytes(client,png,name='arte-270dpi.png')
|
||||
low_png=b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR'+(3366).to_bytes(4,'big')+(2000).to_bytes(4,'big')+b'\x08\x06\x00\x00\x00'+b'\x00'*4
|
||||
low_png=b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR'+(3366).to_bytes(4,'big')+(16240).to_bytes(4,'big')+b'\x08\x06\x00\x00\x00'+b'\x00'*4
|
||||
low=upload_bytes(client,low_png,name='arte-150dpi.png')
|
||||
small={**draft,'request_key':str(uuid4()),'items':[item_spec('avulsa','2.75',90,graded)]}
|
||||
auto=client.call('/quotes',small)
|
||||
@@ -283,7 +288,11 @@ def run():
|
||||
assert mixed_item['stroke_choice']=='client_c3', mixed_item
|
||||
# Loose art split by stroke (item 17): each sheet is an item, and the pair
|
||||
# has one 1 m minimum, on its first sheet.
|
||||
part=lambda metres,n,mode='avulsa':{**item_spec(mode,metres,90,graded),'split':{'group':'f0','part':n,'of':2}}
|
||||
# Each sheet's own file, 6059 px across 57 cm, as long as the sheet.
|
||||
header=lambda rows:b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR'+(6059).to_bytes(4,'big')+rows.to_bytes(4,'big')+b'\x08\x06\x00\x00\x00'+b'\x00'*4
|
||||
sheet_files={'0.3':upload_bytes(client,header(3189),name='folha-30.png'),
|
||||
'0.15':upload_bytes(client,header(1594),name='folha-15.png')}
|
||||
part=lambda metres,n,mode='avulsa':{**item_spec(mode,metres,90,sheet_files[metres]),'split':{'group':'f0','part':n,'of':2}}
|
||||
split={**small,'request_key':str(uuid4()),'items':[part('0.3',1),part('0.15',2)]}
|
||||
client.call('/quotes',{**split,'items':split['items'][:1]},expected=422)
|
||||
client.call('/quotes',{**split,'items':[part('0.3',1),part('0.15',1)]},expected=422)
|
||||
|
||||
Reference in New Issue
Block a user