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 +++++----- juick-www/src/main/webapp/WEB-INF/views/blog_tags.html | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'juick-www/src/main') 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"; diff --git a/juick-www/src/main/webapp/WEB-INF/views/blog_tags.html b/juick-www/src/main/webapp/WEB-INF/views/blog_tags.html index 07f44f8d..51c91e30 100644 --- a/juick-www/src/main/webapp/WEB-INF/views/blog_tags.html +++ b/juick-www/src/main/webapp/WEB-INF/views/blog_tags.html @@ -2,7 +2,7 @@ {% import "views/macros/tags" %} {% block content %}
- {{ tags(user.name, tagStats) }} + {{ tags(user.name, tags) }}
{% endblock %} {% block "column" %} -- cgit v1.2.3