aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-05-24 13:30:25 +0300
committerGravatar Vitaly Takmazov2017-05-24 13:30:25 +0300
commitbd0d43e74be23321ef2991d8a9bc27ad47e1e02a (patch)
tree336e398e0e42ac045bcfe96c323f2ecce7fbd0ae
parent9f2f5a1283711cdca44c1835eeb7bd97e16534a8 (diff)
juick-www: fix tagStats
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/User.java10
-rw-r--r--juick-www/src/main/webapp/WEB-INF/views/blog_tags.html2
2 files changed, 6 insertions, 6 deletions
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 %}
<p>
- {{ tags(user.name, tagStats) }}
+ {{ tags(user.name, tags) }}
</p>
{% endblock %}
{% block "column" %}