Fix trends returning less results per page when filtered in REST API (#17996)
- Change filtering and pagination to occur in SQL instead of Redis - Change rank/score displayed on trends in admin UI to be locale-specific
This commit is contained in:
@@ -37,12 +37,12 @@ class Trends::Base
|
||||
Trends::Query.new(key_prefix, klass)
|
||||
end
|
||||
|
||||
def score(id)
|
||||
redis.zscore("#{key_prefix}:all", id) || 0
|
||||
def score(id, locale: nil)
|
||||
redis.zscore([key_prefix, 'all', locale].compact.join(':'), id) || 0
|
||||
end
|
||||
|
||||
def rank(id)
|
||||
redis.zrevrank("#{key_prefix}:allowed", id)
|
||||
def rank(id, locale: nil)
|
||||
redis.zrevrank([key_prefix, 'allowed', locale].compact.join(':'), id)
|
||||
end
|
||||
|
||||
def currently_trending_ids(allowed, limit)
|
||||
|
Reference in New Issue
Block a user