Skip to content

Commit

Permalink
Fixed issue where incorrect currentVersion was being grabbed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Edwards-cgi committed Feb 27, 2025
1 parent 3b0e887 commit 09470f5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public AdminVersionedMediaResponse getMediaVersionsById(Integer id) {
List<MediaEntity> currentMediaVersions = mediaVersions.stream()
.filter(mediaEntity -> mediaEntity.getIsCurrent() != null)
.filter(media -> media.getIsCurrent())
.sorted(Comparator.comparing(CreatedBaseEntity::getCreatedDateTime).reversed())
.sorted(Comparator.comparing(CreatedBaseEntity::getCreatedDateTime))
.collect(Collectors.toCollection(ArrayList::new));

List<MediaEntity> versionedMedia = mediaVersions.stream()
Expand All @@ -307,7 +307,7 @@ public AdminVersionedMediaResponse getMediaVersionsById(Integer id) {
log.warn("Media with id {} has {} current versions we only expect one", id, currentMediaVersions.size());
currentVersion = currentMediaVersions.getLast();
//Add any extra current events to top of versionedMedia so they still get displayed
currentMediaVersions.removeFirst();
currentMediaVersions.removeLast();
currentMediaVersions
.forEach(mediaEntity -> {
versionedMedia.addFirst(mediaEntity);
Expand Down

0 comments on commit 09470f5

Please sign in to comment.