Sort GET /staff output by the time each grant was created
This commit is contained in:
parent
95944d023d
commit
287e6b744a
@ -21,7 +21,7 @@ public final class GETStaff implements Handler<RoutingContext> {
|
||||
}
|
||||
});
|
||||
|
||||
Map<String, Set<User>> result = new TreeMap<>((a, b) -> {
|
||||
Map<String, List<User>> result = new TreeMap<>((a, b) -> {
|
||||
Rank aRank = staffRanks.get(a);
|
||||
Rank bRank = staffRanks.get(b);
|
||||
|
||||
@ -29,6 +29,7 @@ public final class GETStaff implements Handler<RoutingContext> {
|
||||
});
|
||||
|
||||
List<Grant> staffGrants = SyncUtils.runBlocking(v -> Grant.findByRank(staffRanks.values(), v));
|
||||
staffGrants.sort((a, b) -> a.getAddedAt().compareTo(b.getAddedAt()));
|
||||
|
||||
for (Grant staffGrant : staffGrants) {
|
||||
if (staffGrant.isActive()) {
|
||||
@ -36,7 +37,7 @@ public final class GETStaff implements Handler<RoutingContext> {
|
||||
Rank rank = staffRanks.get(staffGrant.getRank());
|
||||
|
||||
if (!result.containsKey(rank.getId())) {
|
||||
result.put(rank.getId(), new HashSet<>());
|
||||
result.put(rank.getId(), new ArrayList<>());
|
||||
}
|
||||
|
||||
result.get(rank.getId()).add(user);
|
||||
|
Loading…
Reference in New Issue
Block a user