Skip to content

Commit

Permalink
Déplacement des devoirs finis en bas de la journée
Browse files Browse the repository at this point in the history
  • Loading branch information
Bulgus committed Sep 24, 2024
1 parent e996eee commit 75e48a5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/views/account/Homeworks/Homeworks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,20 @@ const WeekView = ({ route, navigation }) => {
return acc;
}, {} as Record<string, Homework[]>);

// 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<string, Homework[]>);

return (
<ScrollView
style={{ width: finalWidth, height: "100%"}}
style={{ width: finalWidth, height: "100%" }}
contentContainerStyle={{
padding: 16,
paddingTop: outsideNav ? 72 : insets.top + 56,
Expand Down

0 comments on commit 75e48a5

Please sign in to comment.