From 5ae62e771ff5b74df5a4e6f1f505a893667524f7 Mon Sep 17 00:00:00 2001 From: Andreas Svanberg <andreass@dsv.su.se> Date: Tue, 4 Mar 2025 10:49:41 +0100 Subject: [PATCH] Sort projects by start date (latest first) and then title since those are the most likely relevant projects. --- .../src/main/java/se/su/dsv/scipro/group/EditGroupPanel.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/view/src/main/java/se/su/dsv/scipro/group/EditGroupPanel.java b/view/src/main/java/se/su/dsv/scipro/group/EditGroupPanel.java index f5e00ef0e6..6aa52c90d2 100644 --- a/view/src/main/java/se/su/dsv/scipro/group/EditGroupPanel.java +++ b/view/src/main/java/se/su/dsv/scipro/group/EditGroupPanel.java @@ -49,7 +49,10 @@ public class EditGroupPanel extends Panel { // since they may not be included in the relevant projects if they're inactive or completed. // To allow them to be removed from the group, it will not be possible to add them again. projects.addAll(model.getObject().getProjects()); - return projects.stream().toList(); + return projects + .stream() + .sorted(Comparator.comparing(Project::getStartDate).reversed().thenComparing(Project::getTitle)) + .toList(); }); add( new ListView<>("available_projects", availableProjects) {