Skip to content

Commit

Permalink
Fix logical error that opens all levels instead of locking them.
Browse files Browse the repository at this point in the history
WaiverAmount should be reducer, not from whom reduces.
  • Loading branch information
BONNe committed Jan 23, 2019
1 parent 38fce9a commit 53da2d6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,10 @@ public List<LevelStatus> getChallengeLevelStatus(User user, World world)
{
// To find how many challenges user still must do in previous level, we must
// know how many challenges there were and how many has been done. Then
// from waiver amount remove calculated value and you get count.
// remove waiver amount to get count of challenges that still necessary to do.

int challengesToDo = previousLevel == null ? 0 :
level.getWaiverAmount() - (previousLevel.getChallenges().size() - doneChallengeCount);
(previousLevel.getChallenges().size() - doneChallengeCount - level.getWaiverAmount());

// As level already contains unique ids of challenges, just iterate through them.
doneChallengeCount = (int) level.getChallenges().stream().filter(playerData::isChallengeDone).count();
Expand Down

0 comments on commit 53da2d6

Please sign in to comment.