Skip to content

Commit f394e5a

Browse files
author
Simon Prickett
committed
Challenge redislabs-training#4 solution and tests.
1 parent 955f23e commit f394e5a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/java/com/redislabs/university/RU102J/dao/CapacityDaoRedisImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ public CapacityReport getReport(Integer limit) {
5959
@Override
6060
public Long getRank(Long siteId) {
6161
// START Challenge #4
62-
return -2L;
62+
try(Jedis jedis = jedisPool.getResource()) {
63+
String key = RedisSchema.getCapacityRankingKey();
64+
return jedis.zrevrank(key, String.valueOf(siteId));
65+
}
6366
// END Challenge #4
6467
}
6568
}

src/test/java/com/redislabs/university/RU102J/dao/CapacityDaoRedisImplTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public void getReport() {
7171
}
7272

7373
// Challenge #4
74-
@Ignore
7574
@Test
7675
public void getRank() {
7776
CapacityDao dao = new CapacityDaoRedisImpl(jedisPool);

0 commit comments

Comments
 (0)