Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General: Fix sorting on audit event log page #9263

Merged
merged 8 commits into from
Sep 6, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.springframework.data.jpa.repository.EntityGraph.EntityGraphType.LOAD;

import java.time.Instant;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -52,6 +53,7 @@ default Page<PersistentAuditEvent> findAllWithDataByAuditEventDateBetween(Instan
return Page.empty(pageable);
}
List<PersistentAuditEvent> result = findWithDataByIdIn(ids);
result.sort(Comparator.comparing(event -> ids.indexOf(event.getId())));
SimonEntholzer marked this conversation as resolved.
Show resolved Hide resolved
return new PageImpl<>(result, pageable, countByAuditEventDateBetween(fromDate, toDate));
}

Expand All @@ -73,6 +75,7 @@ default Page<PersistentAuditEvent> findAllWithData(@NotNull Pageable pageable) {
return Page.empty(pageable);
}
List<PersistentAuditEvent> result = findWithDataByIdIn(ids);
result.sort(Comparator.comparing(event -> ids.indexOf(event.getId())));
return new PageImpl<>(result, pageable, count());
SimonEntholzer marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down
Loading