Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-romine committed Jun 6, 2021
1 parent ceeabc2 commit ba3a8f9
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private Set<Site> findSitesByGeoWithCapacity(GeoQuery query) {
// START Challenge #5
// TODO: Challenge #5: Get the sites matching the geo query, store them

List<GeoRadiusResponse> radiusResponses =
final List<GeoRadiusResponse> radiusResponses =
jedis.georadius(RedisSchema.getSiteGeoKey(), coord.getLng(),
coord.getLat(), radius, radiusUnit);

Expand All @@ -103,10 +103,10 @@ private Set<Site> findSitesByGeoWithCapacity(GeoQuery query) {
.map(Site::new).collect(Collectors.toSet());

// START Challenge #5
Pipeline pipeline = jedis.pipelined();
Map<Long, Response<Double>> scores = new HashMap<>(sites.size());
final Pipeline pipeline = jedis.pipelined();
final Map<Long, Response<Double>> scores = new HashMap<>(sites.size());
// TODO: Challenge #5: Add the code that populates the scores HashMap...
for (Site site : sites) {
for (final Site site : sites) {
final Response<Double> score =
pipeline.zscore(RedisSchema.getCapacityRankingKey(),String.valueOf(site.getId()));
scores.put(site.getId(), score);
Expand All @@ -115,7 +115,7 @@ private Set<Site> findSitesByGeoWithCapacity(GeoQuery query) {
pipeline.sync();
// END Challenge #5

for (Site site : sites) {
for (final Site site : sites) {
if (scores.get(site.getId()).get() >= capacityThreshold) {
results.add(site);
}
Expand Down

0 comments on commit ba3a8f9

Please sign in to comment.