Skip to content

Commit

Permalink
MODINV-1001 The sorting for Items on Instance details page is not wor…
Browse files Browse the repository at this point in the history
…ked (#711)

(cherry picked from commit 15f8cb5)
  • Loading branch information
JavokhirAbdullayev authored and KaterynaSenchenko committed Apr 12, 2024
1 parent 938e889 commit cbcf66e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## 20.3.0-SNAPSHOT 2024-xx-xx
* The sorting for Items on Instance details page is not worked [MODINV-1001](https://folio-org.atlassian.net/browse/MODINV-1001)
* "PMSystem" displayed as source in "quickmarc" view when record was created by "Non-matches" action of job profile [MODSOURCE-608](https://folio-org.atlassian.net/browse/MODSOURCE-608)
* The result table is not displayed in the file details log [MODINV-1003](https://folio-org.atlassian.net/browse/MODINV-1003)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -95,7 +94,7 @@ private void getSingleTitleAndMultiTitleItems(RoutingContext routingContext) {
webContext, routingContext))
.thenCompose(listOfItems -> maybeAppendSingleTitleItems(listOfItems, holdingsRecordId,
webContext, routingContext))
.thenAccept(combinedListOfItems -> sortAndRespond(combinedListOfItems,
.thenAccept(combinedListOfItems -> respondWithPagedManyItems(combinedListOfItems,
webContext, routingContext));
}

Expand Down Expand Up @@ -177,12 +176,9 @@ private CompletableFuture<List<Item>> maybeAppendSingleTitleItems(
return futureListOfItems;
}

private void sortAndRespond(List<Item> itemList, WebContext webContext, RoutingContext routingContext) {
private void respondWithPagedManyItems(List<Item> itemList, WebContext webContext, RoutingContext routingContext) {
PagingParameters pagingParameters = getPagingParameters(webContext);
List<Item> sortedList = itemList.stream().sorted(
Comparator.comparing(i -> i.getBarcode() == null ? "~" : i.getBarcode()))
.toList();
MultipleRecords<Item> items = new MultipleRecords<>(getPage(sortedList,
MultipleRecords<Item> items = new MultipleRecords<>(getPage(itemList,
pagingParameters.offset, pagingParameters.limit), itemList.size());
respondWithManyItems(routingContext, webContext, items);
}
Expand Down

0 comments on commit cbcf66e

Please sign in to comment.