about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-07-16 19:54:14 +0200
committerGitHub <noreply@github.com>2018-07-16 19:54:14 +0200
commit69c34f34382ee2f373e60ee705c8b3685fa77b11 (patch)
tree51fdd98eeebc01335b01cb8a7428f918e474eddf
parent8241f162dfa4f7c2cfe79d6f18ddcbd2de4def0c (diff)
Fix number of results returned from TrendingTags.get
-rw-r--r--app/models/trending_tags.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/trending_tags.rb b/app/models/trending_tags.rb
index b11f35292..c559651c6 100644
--- a/app/models/trending_tags.rb
+++ b/app/models/trending_tags.rb
@@ -17,7 +17,7 @@ class TrendingTags
 
     def get(limit)
       key     = "#{KEY}:#{Time.now.utc.beginning_of_day.to_i}"
-      tag_ids = redis.zrevrange(key, 0, limit).map(&:to_i)
+      tag_ids = redis.zrevrange(key, 0, limit - 1).map(&:to_i)
       tags    = Tag.where(id: tag_ids).to_a.map { |tag| [tag.id, tag] }.to_h
       tag_ids.map { |tag_id| tags[tag_id] }.compact
     end