diff --git a/src/main/java/org/ntlab/citrusserver/repositories/PublicBookManager.java b/src/main/java/org/ntlab/citrusserver/repositories/PublicBookManager.java index 3bc8d98..55fc5a5 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/PublicBookManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/PublicBookManager.java @@ -116,12 +116,7 @@ case 2: ArrayList booksForSort = new ArrayList<>(); for(Book book : books){ - HashSet favorites = favoriteManager.getFavorited(book.getAccountId(), book.getBookId()); - int count = 0; - if(favorites != null){ - count = favorites.size(); - } - booksForSort.add(new BookForSort(book, count)); + booksForSort.add(new BookForSort(book, book.getFavoritedCount())); } booksForSort.sort(Comparator.comparing(BookForSort::favoriteNum).reversed()); ArrayList res = new ArrayList<>();