2026 봄 축제 탭 추가 및 데이터 반영#519
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a 'Festival' filter for partnerships, updating the data models, UI components, and MapViewModel. Feedback suggests using a configuration flag or remote config instead of commenting out code to force the default filter, leveraging automatic serialization for enum mapping, and addressing potential performance and race condition issues in the ViewModel. Additionally, unit tests for the new mapping and filtering logic should be added.
| // val initialFilter = if (newDepartmentId == -1L) FilterType.All else FilterType.Mine // TODO 축제기간 종료 시 주석 해제 | ||
| val initialFilter = FilterType.Festival // TODO 축제기간 한정 Festival 강제. 축제기간 끝나면 주석 |
| periodType = when (it.periodType) { | ||
| "FESTIVAL" -> PeriodType.FESTIVAL | ||
| else -> PeriodType.NORMAL | ||
| } |
There was a problem hiding this comment.
| private fun loadFestivalPartnerships() { | ||
| viewModelScope.launch { | ||
| val current = uiState.value | ||
| val currentData = if (current is UiState.Success) current.data else MapState() | ||
|
|
||
| _uiState.value = UiState.Loading | ||
|
|
||
| val partnerships = partnershipRepository.getAllPartnerships().mapNotNull { | ||
| val festivalInfos = | ||
| it.partnershipInfos.filter { info -> info.periodType == PeriodType.FESTIVAL } | ||
| if (festivalInfos.isEmpty()) return@mapNotNull null | ||
|
|
||
| it.copy( | ||
| partnershipInfos = festivalInfos | ||
| ) | ||
| } | ||
|
|
||
| _uiState.value = UiState.Success( | ||
| currentData.copy( | ||
| partnerships = partnerships, | ||
| filterChangeResult = null | ||
| ) | ||
| ) | ||
| } | ||
| } |
There was a problem hiding this comment.
| val initialFilter = if (newDepartmentId == -1L) FilterType.All else FilterType.Mine | ||
|
|
||
| // val initialFilter = if (newDepartmentId == -1L) FilterType.All else FilterType.Mine // TODO 축제기간 종료 시 주석 해제 | ||
| val initialFilter = FilterType.Festival // TODO 축제기간 한정 Festival 강제. 축제기간 끝나면 주석 |
There was a problem hiding this comment.
이 부분 무조건 Festival이 아니라 Festival인 애가 존재하는 경우에만 이렇게 initialFilter를 Festival로 설정해야해요!!
| val endDate: String? = null | ||
| val endDate: String? = null, | ||
| @SerialName("periodType") | ||
| val periodType: String? = null |
There was a problem hiding this comment.
kotlinx.serialization이 enum 직렬화 처리를 해줘서 String을 받고 아래에서 파싱하는 방법이 아니어도 됩니다! 대신 PeriodType를 @serializable로 달아야 해요.
Festival 정보가 존재하는지 확인하기 위해 fetch한 데이터는 첫 탭에서 그대로 활용
PeraSite
left a comment
There was a problem hiding this comment.
private fun List.festivalPartnerships() 은 mapNotNull + return null보단 filter를 쓰는 것이 적합하지 않나용?!
다만 시간이 없으므로 우선 승인합니당
|
List 인 상태에서 그 내부에 또 partnershipInfos: List 가 중첩인 구조인데 partnershipInfos.periodType이 FESTIVAL 인게 하나도 없을땐 그 partnership 자체를 패스시켜야 하는데 뭔가 딱 떠오르는 방법이 없었어요 ㅠㅠ |
private fun List<Partnership>.festivalPartnerships(): List<Partnership> =
filter { partnership ->
partnership.partnershipInfos.any { it.periodType == PeriodType.FESTIVAL }
}이렇게 적으면 될 것 같아요! 페스티벌이 하나도 없으면 패스시킨다가 아니라 페스티벌이 하나라도 있는 애를 골라내는거죵 |
|
근데 [축제] 탭인 상태에서 가게 눌렀을때, 축제에 해당하는 할인 항목만 보여줘야 하지 않나요?? 그건 상관 없나요? |
|
아 UI에서 거르면 되는구나 확인했습니다 |
|
굿굿입니당 |
Summary
기존 PartnerShipInfo에 periodType을 추가하고 지도에 [축제] 탭을 추가해서 PeriodType.FESTIVAL 인 데이터만 모아볼 수 있도록 했습니다
Describe your changes
Android.Studio.2026.05.11.180457.mp4
Issue
To reviewers