diff --git a/lua/insert_sorted.lua b/lua/insert_sorted.lua index 885f301..064518c 100644 --- a/lua/insert_sorted.lua +++ b/lua/insert_sorted.lua @@ -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) diff --git a/views/game/featured.js b/views/game/featured.js index d54b698..f60fcc4 100644 --- a/views/game/featured.js +++ b/views/game/featured.js @@ -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