diff --git a/src/main/java/com/redislabs/university/RU102J/dao/CapacityDaoRedisImpl.java b/src/main/java/com/redislabs/university/RU102J/dao/CapacityDaoRedisImpl.java index 8e24d22..2c9d884 100644 --- a/src/main/java/com/redislabs/university/RU102J/dao/CapacityDaoRedisImpl.java +++ b/src/main/java/com/redislabs/university/RU102J/dao/CapacityDaoRedisImpl.java @@ -59,7 +59,12 @@ public CapacityReport getReport(Integer limit) { @Override public Long getRank(Long siteId) { // START Challenge #4 - return -2L; + String key = RedisSchema.getCapacityRankingKey(); + + try (Jedis jedis = jedisPool.getResource()) { + final Long rank = jedis.zrevrank(key, siteId.toString()); + return rank; + } // END Challenge #4 } } diff --git a/src/test/java/com/redislabs/university/RU102J/dao/CapacityDaoRedisImplTest.java b/src/test/java/com/redislabs/university/RU102J/dao/CapacityDaoRedisImplTest.java index 82917b6..43c0898 100644 --- a/src/test/java/com/redislabs/university/RU102J/dao/CapacityDaoRedisImplTest.java +++ b/src/test/java/com/redislabs/university/RU102J/dao/CapacityDaoRedisImplTest.java @@ -71,7 +71,6 @@ public void getReport() { } // Challenge #4 - @Ignore @Test public void getRank() { CapacityDao dao = new CapacityDaoRedisImpl(jedisPool);