Skip to content

Commit

Permalink
Feature/moneymong 509 장부 내역 기간별 조회 이슈 수정 (#34)
Browse files Browse the repository at this point in the history
* fix: 장부 조회 종료 연도가 시작 연도보다 작아도 동작하는 이슈 수정

* fix: 소속 변경 시 조회 기간 초기화
  • Loading branch information
Heonbyeong authored Oct 1, 2024
1 parent 3812739 commit 84c9a73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,7 @@ fun MDSWheelDatePicker(
snappedEndYear,
snappedEndMonth
) {
isValidValue = if (snappedStartYear < snappedEndYear) {
true
} else {
snappedStartMonth <= snappedEndMonth
}

isValidValue = snappedStartYear <= snappedEndYear && snappedStartMonth <= snappedEndMonth
confirmValidValue(isValidValue)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class LedgerViewModel @Inject constructor(
reduce { state.copy(isAgencyExistLoading = true) }
fetchAgencyExistLedgerUseCase(state.agencyId)
.onSuccess {
Log.d("fetchAgencyExistLedger${state.agencyId}",it.toString() )
Log.d("fetchAgencyExistLedger${state.agencyId}", it.toString())
reduce {
state.copy(
isExistLedger = it,
Expand All @@ -96,7 +96,7 @@ class LedgerViewModel @Inject constructor(
page = 0,
limit = 100
).onSuccess {
Log.d("fetchLedgerTransactionList${state.existAgency}",it.toString() )
Log.d("fetchLedgerTransactionList${state.existAgency}", it.toString())

reduce {
state.copy(
Expand Down Expand Up @@ -127,7 +127,7 @@ class LedgerViewModel @Inject constructor(
reduce { state.copy(isMyAgencyLoading = true) }
fetchMyAgencyListUseCase()
.onSuccess {
Log.d("fetchMyAgencyList${state.existAgency}",it.toString() )
Log.d("fetchMyAgencyList${state.existAgency}", it.toString())

reduce {
state.copy(
Expand Down Expand Up @@ -188,6 +188,7 @@ class LedgerViewModel @Inject constructor(

fun reFetchLedgerData(agencyId: Int) {
saveAgencyId(agencyId)
updateSelectedDate(startDate = LocalDate.now().minusMonths(6), endDate = LocalDate.now())
fetchAgencyExistLedger()
fetchAgencyMemberList()
fetchLedgerTransactionList()
Expand Down Expand Up @@ -227,15 +228,8 @@ class LedgerViewModel @Inject constructor(
}

fun onClickDateChange(startDate: LocalDate, endDate: LocalDate) {
intent {
reduce {
state.copy(
startDate = startDate,
endDate = endDate
)
}
postSideEffect(LedgerSideEffect.LedgerCloseSheet)
}
updateSelectedDate(startDate = startDate, endDate = endDate)
eventEmit(LedgerSideEffect.LedgerCloseSheet)
fetchLedgerTransactionList()
}

Expand All @@ -262,4 +256,13 @@ class LedgerViewModel @Inject constructor(
)
}
}

fun updateSelectedDate(startDate: LocalDate, endDate: LocalDate) = intent {
reduce {
state.copy(
startDate = startDate,
endDate = endDate
)
}
}
}

0 comments on commit 84c9a73

Please sign in to comment.