mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-11 23:06:00 +00:00
Fix achievement sorting
This commit is contained in:
parent
56d6a8995b
commit
fb4860d441
1 changed files with 9 additions and 1 deletions
|
|
@ -86,7 +86,15 @@ class AchievementsFragment: BaseMainFragment(), SwipeRefreshLayout.OnRefreshList
|
|||
|
||||
refreshLayout.setOnRefreshListener(this)
|
||||
|
||||
compositeSubscription.add(userRepository.getAchievements().subscribe(Consumer<RealmResults<Achievement>> {
|
||||
compositeSubscription.add(userRepository.getAchievements().map { achievements ->
|
||||
achievements.sortedBy {
|
||||
if (it.category == "onboarding") {
|
||||
it.index
|
||||
} else {
|
||||
(it.category?.first()?.toInt() ?: 2) * it.index
|
||||
}
|
||||
}
|
||||
}.subscribe(Consumer {
|
||||
val entries = mutableListOf<Any>()
|
||||
var lastCategory = ""
|
||||
it.forEach { achievement ->
|
||||
|
|
|
|||
Loading…
Reference in a new issue