Skip to content

Commit

Permalink
Merge pull request #71 from Nexters/bug/70/sub_skills
Browse files Browse the repository at this point in the history
Close #70 서브 스킬 리스트 불러오기 로직 수정
  • Loading branch information
eoqkrskfk94 authored Mar 5, 2022
2 parents d6aadff + 6c7ef95 commit 00af0ba
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,17 @@ class AddSubSkillViewModel @Inject constructor(
this.parentSkillId = parentSkillId
viewModelScope.launch {

getProfileUseCase().getValue()?.let { profile ->
profile.skills.find { it.skill.id == parentSkillId.toString() }?.let {
val mySkills = it.childSkills.map { it.id to it }.toMap()
originSkillTree.find { it.skill.id == parentSkillId.toString() }?.let { skillTree ->
val mySkills = skillTree.childSkills.map { it.id to it }.toMap()

getAllSkillUseCase().getValue().find { it.skill.id == parentSkillId.toString() }?.run {
_items.value = this.childSkills.map { skill ->
if(mySkills[skill.id] != null)
CategorySelect(skill.id, skill.name, skill.parentId, skill.layer, true)
else
CategorySelect(skill.id, skill.name, skill.parentId, skill.layer, false)
}
items.value?.filter { it.selected }?.run { addSelectedSkills(this) }
getAllSkillUseCase().getValue().find { it.skill.id == parentSkillId.toString() }?.run {
_items.value = this.childSkills.map { skill ->
if(mySkills[skill.id] != null)
CategorySelect(skill.id, skill.name, skill.parentId, skill.layer, true)
else
CategorySelect(skill.id, skill.name, skill.parentId, skill.layer, false)
}
items.value?.filter { it.selected }?.run { addSelectedSkills(this) }
}
}

Expand Down

0 comments on commit 00af0ba

Please sign in to comment.