From 5ffdca6323224224daf50c932ce03c31eed223cc Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 9 May 2023 12:16:42 +0200 Subject: [PATCH] :bug: Fixing percentage --- src/front/Components/DesignSystem/UserFolder/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/front/Components/DesignSystem/UserFolder/index.tsx b/src/front/Components/DesignSystem/UserFolder/index.tsx index ec45279b..2abe3b37 100644 --- a/src/front/Components/DesignSystem/UserFolder/index.tsx +++ b/src/front/Components/DesignSystem/UserFolder/index.tsx @@ -140,7 +140,10 @@ export default class UserFolder extends React.Component { if (!this.props.customer.documents) return 0; const totalDocuments: number = this.props.customer.documents.length; const numberDocumentsAsked: number = this.getDocumentsByStatus(EDocumentStatus.ASKED)?.length || 0; - return Math.round(((totalDocuments - numberDocumentsAsked) / totalDocuments) * 100); + + const percentage = Math.round(((totalDocuments - numberDocumentsAsked) / totalDocuments) * 100); + if(!percentage) return 0; + return percentage; } private getDocumentsByStatus(status: string): Document[] | null {