From bd0d43e74be23321ef2991d8a9bc27ad47e1e02a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 24 May 2017 13:30:25 +0300 Subject: juick-www: fix tagStats --- juick-www/src/main/java/com/juick/www/controllers/User.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'juick-www/src/main/java') diff --git a/juick-www/src/main/java/com/juick/www/controllers/User.java b/juick-www/src/main/java/com/juick/www/controllers/User.java index 8e22c654..5435e23d 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/User.java +++ b/juick-www/src/main/java/com/juick/www/controllers/User.java @@ -159,8 +159,6 @@ public class User { msgs.forEach(m -> m.ReadOnly |= blUIDs.contains(m.getUser().getUid())); } model.addAttribute("msgs", msgs); - model.addAttribute("tags", tagService.getUserTagStats(user.getUid()).stream() - .sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).limit(20).collect(Collectors.toList())); model.addAttribute("headers", head); model.addAttribute("showAdv", paramShow == null && before == 0 && paramSearch == null && visitor.getUid() == 0); @@ -209,7 +207,9 @@ public class User { model.addAttribute("statsReplies", userService.getStatsReplies(user.getUid())); model.addAttribute("iread", userService.getUserReadLeastPopular(user.getUid(), 8)); model.addAttribute("tagStats", tagService.getUserTagStats(user.getUid()) - .stream().map(t -> t.getTag().getName()).collect(Collectors.toList())); + .stream().sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).limit(20).map(t -> t.getTag().getName()).collect(Collectors.toList())); + model.addAttribute("tags", tagService.getUserTagStats(user.getUid()).stream() + .sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).collect(Collectors.toList())); return "views/blog_tags"; } @@ -235,7 +235,7 @@ public class User { model.addAttribute("statsReplies", userService.getStatsReplies(user.getUid())); model.addAttribute("iread", userService.getUserReadLeastPopular(user.getUid(), 8)); model.addAttribute("tagStats", tagService.getUserTagStats(user.getUid()) - .stream().map(t -> t.getTag().getName()).collect(Collectors.toList())); + .stream().sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).limit(20).map(t -> t.getTag().getName()).collect(Collectors.toList())); model.addAttribute("users", userService.getUserFriends(user.getUid())); return "views/users"; @@ -262,7 +262,7 @@ public class User { model.addAttribute("statsReplies", userService.getStatsReplies(user.getUid())); model.addAttribute("iread", userService.getUserReadLeastPopular(user.getUid(), 8)); model.addAttribute("tagStats", tagService.getUserTagStats(user.getUid()) - .stream().map(t -> t.getTag().getName()).collect(Collectors.toList())); + .stream().sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).limit(20).map(t -> t.getTag().getName()).collect(Collectors.toList())); model.addAttribute("users", userService.getUserReaders(user.getUid())); return "views/users"; -- cgit v1.2.3