backport_legacy_fix #19

Merged
sosthene merged 2 commits from backport_legacy_fix into dev 2025-08-11 08:07:52 +00:00
2 changed files with 8 additions and 5 deletions
Showing only changes of commit 8aa82f3a9c - Show all commits

View File

@ -438,10 +438,11 @@ export default function DocumentTables(props: IProps) {
); );
const progress = useMemo(() => { 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; if (total === 0) return 0;
return (validatedDocuments.length / total) * 100; 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 />; if (documents.length === 0 && documentsNotary.length === 0) return <NoDocument />;

View File

@ -48,9 +48,11 @@ export default function FolderInformation(props: IProps) {
let total = 0; let total = 0;
let validatedDocuments = 0; let validatedDocuments = 0;
folder?.customers?.forEach((customer: any) => { folder?.customers?.forEach((customer: any) => {
const documents = customer.documents.filter((document: any) => document.depositor); const documents = customer.documents;
total += documents?.length ?? 0; // Only count documents that are not refused (still in progress)
validatedDocuments += documents?.filter((document: any) => document.document_status === EDocumentStatus.VALIDATED).length ?? 0; 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; if (total === 0) return 0;
const percentage = (validatedDocuments / total) * 100; const percentage = (validatedDocuments / total) * 100;