From dd5e4aa898a33711156bc1af61491e02aaa4b15a Mon Sep 17 00:00:00 2001 From: vladkash Date: Thu, 27 Jul 2023 13:24:20 +0500 Subject: [PATCH] add processing of locked badges from backend --- .../org/hyperskill/app/profile/view/BadgesViewStateMapper.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/src/commonMain/kotlin/org/hyperskill/app/profile/view/BadgesViewStateMapper.kt b/shared/src/commonMain/kotlin/org/hyperskill/app/profile/view/BadgesViewStateMapper.kt index 252a9b7c09..bd44a18be9 100644 --- a/shared/src/commonMain/kotlin/org/hyperskill/app/profile/view/BadgesViewStateMapper.kt +++ b/shared/src/commonMain/kotlin/org/hyperskill/app/profile/view/BadgesViewStateMapper.kt @@ -14,8 +14,8 @@ class BadgesViewStateMapper( } fun map(state: ProfileFeature.BadgesState): BadgesViewState { - val unlockedBadges = state.badges.sortedBy { it.level }.map(::mapUnlockedBadge) - val lockedBadges = getLockedBadgeKinds(state.badges.map { it.kind }).map(::mapLockedBadge) + val unlockedBadges = state.badges.filter { it.level > 0 }.sortedBy { it.level }.map(::mapUnlockedBadge) + val lockedBadges = getLockedBadgeKinds(unlockedBadges.map { it.kind }).map(::mapLockedBadge) val allBadges = unlockedBadges + lockedBadges return BadgesViewState(