Skip to content

Commit

Permalink
fix: filter transaction not working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrahamOsmondE authored and therajanmaurya committed Mar 25, 2024
1 parent 319dd87 commit 77c8119
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class SavingAccountsTransactionFragment : BaseFragment() {
.setTitle(R.string.select_you_want)
.setView(dialogView)
.setPositiveButton(getString(R.string.filter)) { _, _ ->
if (checkBoxPeriod?.isChecked == true) {
if (checkBoxPeriod?.isChecked == true || isCheckBoxPeriod) {
if (!isReady) {
Toaster.show(binding.root, getString(R.string.select_date))
return@setPositiveButton
Expand Down Expand Up @@ -425,9 +425,11 @@ class SavingAccountsTransactionFragment : BaseFragment() {
* @param endDate Ending date
*/
private fun filter(startDate: Long?, endDate: Long?, statusModelList: List<CheckboxStatus?>?) {
val dummyTransactionList = filterSavingsAccountTransactionsByType(statusModelList)
val hasOtherFilters = statusModelList?.any { it!!.isChecked }
val transactionListToFilter = if (hasOtherFilters == true) filterSavingsAccountTransactionsByType(statusModelList) else transactionsList

viewModel.filterTransactionList(
dummyTransactionList,
transactionListToFilter,
startDate,
endDate,
)
Expand Down

0 comments on commit 77c8119

Please sign in to comment.