Skip to content

Commit

Permalink
Merge pull request #237 from TeamDMU/fix/cafeteria-api
Browse files Browse the repository at this point in the history
Fix : ์‹๋‹จ API ์˜ค๋ฅ˜ ์ˆ˜์ •
  • Loading branch information
huiwoo-jo authored Apr 21, 2024
2 parents 4a9a706 + bff8fda commit f59c933
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ class CafeteriaViewModel(
fun updateMenuList(selectedDate: LocalDate) {
val cafeteriaList = _cafeteriaList.value ?: emptyList()
_selectedDate.value = selectedDate
val selectedMenu = cafeteriaList.find { it.date == selectedDate.toString() }?.menus
_menus.postValue(
cafeteriaList.find { it.date == selectedDate.toString() }?.menus
.takeIf { it.isNullOrEmpty() }
?.let { emptyMenu }
?: cafeteriaList.find { it.date == selectedDate.toString() }?.menus
if (selectedMenu.isNullOrEmpty()) {
emptyMenu
} else {
selectedMenu
}
)
}
}

0 comments on commit f59c933

Please sign in to comment.