Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/moneymong 509 장부 내역 기간별 조회 이슈 수정 #34

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
)
}
}
}
Loading