From 75e48a53084e511df9ed5d41e9d9ce9869c1b483 Mon Sep 17 00:00:00 2001 From: Bulgus Date: Wed, 25 Sep 2024 01:21:28 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9placement=20des=20devoirs=20finis=20en?= =?UTF-8?q?=20bas=20de=20la=20journ=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/account/Homeworks/Homeworks.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/views/account/Homeworks/Homeworks.tsx b/src/views/account/Homeworks/Homeworks.tsx index 12c784dc..4b833552 100644 --- a/src/views/account/Homeworks/Homeworks.tsx +++ b/src/views/account/Homeworks/Homeworks.tsx @@ -179,9 +179,20 @@ const WeekView = ({ route, navigation }) => { return acc; }, {} as Record); + // Moved completed homework to the bottom of the day + const sortedGroupedHomework = Object.keys(groupedHomework).reduce((acc, day) => { + acc[day] = groupedHomework[day].sort((a, b) => { + if (a.done === b.done) { + return 0; // Keep the current order if both are either completed or not completed + } + return a.done ? 1 : -1; // Unfinished at the top, finished at the bottom + }); + return acc; + }, {} as Record); + return (