Skip to content

Commit

Permalink
Fix the issue with incorrect unlock status. (#169)
Browse files Browse the repository at this point in the history
The issue was that it never decrease challengesToDo with completed challenges from previous level, so only first level was unlocked. My mistake.
  • Loading branch information
BONNe authored and BuildTools committed Sep 2, 2019
1 parent 0026cb7 commit 707625a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@ private LevelStatus getChallengeLevelStatus(@NonNull String storageDataID, World
ChallengeLevel previousLevel = levelIndex < 1 ? null : challengeLevelList.get(levelIndex - 1);

int challengesToDo = previousLevel == null ? 0 :
(previousLevel.getChallenges().size() - level.getWaiverAmount());
(previousLevel.getChallenges().size() - level.getWaiverAmount()) -
(int) previousLevel.getChallenges().stream().filter(playerData::isChallengeDone).count();

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

0 comments on commit 707625a

Please sign in to comment.