Skip to content

Commit

Permalink
Fix issue when Challenges were not sorted by order number.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Feb 10, 2019
1 parent dff3608 commit 2bbb4e5
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,8 @@ public List<Challenge> getAllChallenges(World world)
String worldName = Util.getWorld(world).getName();
// TODO: Probably need to check also database.
return this.challengeCacheData.values().stream().
sorted(Comparator.comparing(Challenge::getOrder)).
filter(challenge -> challenge.getUniqueId().startsWith(worldName)).
sorted(Comparator.comparing(Challenge::getOrder)).
collect(Collectors.toList());
}

Expand All @@ -705,6 +705,7 @@ public List<Challenge> getFreeChallenges(World world)
// Free Challenges hides under FREE level.
return this.getAllChallenges(world).stream().
filter(challenge -> challenge.getLevel().equals(FREE)).
sorted(Comparator.comparing(Challenge::getOrder)).
collect(Collectors.toList());
}

Expand All @@ -719,6 +720,7 @@ public List<Challenge> getLevelChallenges(ChallengeLevel level)
return level.getChallenges().stream().
map(this::getChallenge).
filter(Objects::nonNull).
sorted(Comparator.comparing(Challenge::getOrder)).
collect(Collectors.toList());
}

Expand Down

0 comments on commit 2bbb4e5

Please sign in to comment.