From 5feca677433100f16844350f8804a6285619afc4 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 27 Apr 2023 11:48:32 +0200 Subject: [PATCH] :bug: Sort folders by pending documents --- src/front/Components/DesignSystem/FolderList/index.tsx | 6 +++++- src/front/Components/Layouts/DesignSystem/dummyData.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/front/Components/DesignSystem/FolderList/index.tsx b/src/front/Components/DesignSystem/FolderList/index.tsx index 778aad3c..d208c2aa 100644 --- a/src/front/Components/DesignSystem/FolderList/index.tsx +++ b/src/front/Components/DesignSystem/FolderList/index.tsx @@ -27,7 +27,11 @@ class FolderListClass extends React.Component { : Module.getInstance().get().modules.pages.Folder.pages.FolderInformation.props.path; return (
- {this.props.folders.map((folder) => { + {this.props.folders.sort((folder) => { + const pendingDocuments = folder.documents!.filter((document) => document.document_status === "PENDING"); + console.log(pendingDocuments.length); + return pendingDocuments.length >= 1 ? -1 : 1; + }).map((folder) => { return (