alter argu position, handle null rank

This commit is contained in:
scottmeng 2014-04-08 11:44:45 +08:00
Родитель 7c5a0bd42b
Коммит 9b1c4a3df0
2 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -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