зеркало из https://github.com/mozilla/galaxy-api.git
alter argu position, handle null rank
This commit is contained in:
Родитель
7c5a0bd42b
Коммит
9b1c4a3df0
|
@ -1,10 +1,17 @@
|
|||
local key = KEYS[1]
|
||||
local member = ARGV[2]
|
||||
local score = ARGV[1]
|
||||
local member = ARGV[1]
|
||||
local score = ARGV[2]
|
||||
|
||||
local count = redis.call("ZCARD", key)
|
||||
local curPosition = redis.call("ZSCORE", key, member)
|
||||
|
||||
-- if game is featured but no new position is given
|
||||
if (score == nil and curPosition ~= false) then
|
||||
return 0
|
||||
else
|
||||
score = count + 1
|
||||
end
|
||||
|
||||
-- if game is not yet featured
|
||||
if curPosition == false then
|
||||
local items = redis.call("ZRANGEBYSCORE", key, score, count)
|
||||
|
|
|
@ -78,6 +78,10 @@ module.exports = function(server) {
|
|||
description: 'Game slug',
|
||||
isRequired: true
|
||||
},
|
||||
rank: {
|
||||
description: 'Game rank',
|
||||
isRequired: false;
|
||||
},
|
||||
genres: {
|
||||
description: 'List of genres',
|
||||
isRequired: false
|
||||
|
|
Загрузка…
Ссылка в новой задаче