fix: the card's "Arquivo gerado" names every part of a film, not the first one's (#130)
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 7m56s
Build and deploy / Secret scan and release gate (push) Successful in 11s
Build and deploy / Publish images (push) Successful in 1m28s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-27 13:27:19 -03:00
parent 3204ec4368
commit eb56c49016

View File

@@ -494,6 +494,7 @@ const FINAL_TITLE={correction:'Correção do cliente',generated:'Gerado pelo sis
// What the system generated for an item: one PNG, or the parts of a film
// over 15 m (item 13). An item generated before parts has just its file.
const generatedFiles=row=>row.parts?.length?row.parts:[{upload_id:row.upload_id,name:row.name}];
const partsLabel=files=>files.length>1?files.length+' partes, '+files[0].name+' a '+files[files.length-1].name:files[0].name;
// Per item, the files that can be approved as they are, or null: the
// customer's correction, or else what the system generated (or the original
// that already was one). After a correction, a generated file reproduces
@@ -506,7 +507,7 @@ function readyFinals(order){
const made=fixes.length?null:(order.print_files||[]).find(r=>r.item_index===index&&r.status==='ready');
if(!made)return null;
const original=made.detail?.source==='original', files=generatedFiles(made);
const names=files.length>1?files.length+' partes, '+files[0].name+' a '+files[files.length-1].name:files[0].name;
const names=partsLabel(files);
return {files,name:files[0].name,source:original?'original':'generated',label:(original?'O original (':'Gerado pelo sistema (')+names+')'};
});
}
@@ -1089,7 +1090,8 @@ function itemCard(order,item,index){
}else{
const original=row.status==='ready'&&row.detail?.source==='original';
notes.append(itemNote((original?'O original é o arquivo de impressão':PRINT_TEXT[row.status])+
(row.status==='ready'&&row.name&&!original?': '+row.name:'')+(row.status==='ready'&&row.detail?.vector_sources&&!original?', PDF vetorial':''),row.status==='ready'?'ok':''));
// A film in parts is all its parts, not the first one's name (#130).
(row.status==='ready'&&row.name&&!original?': '+partsLabel(generatedFiles(row)):'')+(row.status==='ready'&&row.detail?.vector_sources&&!original?', PDF vetorial':''),row.status==='ready'?'ok':''));
}
if(['rec','tra','cor'].includes(order.state)){
const done=(order.final_items||[]).includes(index);