Created
March 29, 2022 08:42
-
-
Save Hkazanci93/7419d05c67af51fa94b674f5f0c29526 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String biggestSpendersKey = SORTED_SET_KEY + principal.getName(); | |
Set<TypedTuple<String>> range = redis.opsForZSet().rangeByScoreWithScores(biggestSpendersKey, 0, | |
Double.MAX_VALUE); | |
if (range.size() > 0) { | |
BiggestSpenders biggestSpenders = new BiggestSpenders(range.size()); | |
int i = 0; | |
for (TypedTuple<String> typedTuple : range) { | |
biggestSpenders.getSeries()[i] = Math.floor(typedTuple.getScore() * 100) / 100; | |
biggestSpenders.getLabels()[i] = typedTuple.getValue(); | |
i++; | |
} | |
return biggestSpenders; | |
} else { | |
return new BiggestSpenders(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment