[bug] Don't count refused documents on progress bar for a folder
This commit is contained in:
parent
6e86e65845
commit
8aa82f3a9c
@ -438,10 +438,11 @@ export default function DocumentTables(props: IProps) {
|
||||
);
|
||||
|
||||
const progress = useMemo(() => {
|
||||
const total = askedDocuments.length + toValidateDocuments.length + validatedDocuments.length + refusedDocuments.length;
|
||||
// Exclude refused documents from total - only count documents that are still in progress
|
||||
const total = askedDocuments.length + toValidateDocuments.length + validatedDocuments.length;
|
||||
if (total === 0) return 0;
|
||||
return (validatedDocuments.length / total) * 100;
|
||||
}, [askedDocuments.length, refusedDocuments.length, toValidateDocuments.length, validatedDocuments.length]);
|
||||
}, [askedDocuments.length, toValidateDocuments.length, validatedDocuments.length]);
|
||||
|
||||
if (documents.length === 0 && documentsNotary.length === 0) return <NoDocument />;
|
||||
|
||||
|
@ -48,9 +48,11 @@ export default function FolderInformation(props: IProps) {
|
||||
let total = 0;
|
||||
let validatedDocuments = 0;
|
||||
folder?.customers?.forEach((customer: any) => {
|
||||
const documents = customer.documents.filter((document: any) => document.depositor);
|
||||
total += documents?.length ?? 0;
|
||||
validatedDocuments += documents?.filter((document: any) => document.document_status === EDocumentStatus.VALIDATED).length ?? 0;
|
||||
const documents = customer.documents;
|
||||
// Only count documents that are not refused (still in progress)
|
||||
const activeDocuments = documents?.filter((document: any) => document.document_status !== EDocumentStatus.REFUSED) ?? [];
|
||||
total += activeDocuments.length;
|
||||
validatedDocuments += activeDocuments.filter((document: any) => document.document_status === EDocumentStatus.VALIDATED).length;
|
||||
});
|
||||
if (total === 0) return 0;
|
||||
const percentage = (validatedDocuments / total) * 100;
|
||||
|
Loading…
x
Reference in New Issue
Block a user