@@ -346,8 +346,8 @@ class SyncCentersDialogViewModel(
346
346
repository.syncLoanRepaymentTemplate(loanId),
347
347
) { loanWithAssociations, loanRepaymentTemplate ->
348
348
LoanAndLoanRepayment (
349
- loanWithAssociations,
350
- loanRepaymentTemplate,
349
+ loanWithAssociations.data ,
350
+ loanRepaymentTemplate.data ,
351
351
)
352
352
}
353
353
}
@@ -376,8 +376,8 @@ class SyncCentersDialogViewModel(
376
376
),
377
377
) { savingsAccountWithAssociations, savingsAccountTransactionTemplate ->
378
378
SavingsAccountAndTransactionTemplate (
379
- savingsAccountWithAssociations,
380
- savingsAccountTransactionTemplate,
379
+ savingsAccountWithAssociations.data ,
380
+ savingsAccountTransactionTemplate.data ,
381
381
)
382
382
}
383
383
}
@@ -763,41 +763,32 @@ class SyncCentersDialogViewModel(
763
763
}
764
764
765
765
fun getActiveLoanAccounts (loanAccountList : List <LoanAccountEntity >? ): List <LoanAccountEntity > {
766
- val loanAccounts: MutableList <LoanAccountEntity > = ArrayList ()
767
- Observable .from(loanAccountList)
768
- .filter { loanAccount -> loanAccount.status?.active }
769
- .subscribe { loanAccount -> loanAccounts.add(loanAccount) }
770
- return loanAccounts
766
+ return loanAccountList?.filter {
767
+ it.status?.active == true
768
+ }.orEmpty()
771
769
}
772
770
773
771
fun getActiveSavingsAccounts (savingsAccounts : List <SavingsAccountEntity >? ): List <SavingsAccountEntity > {
774
- val accounts: MutableList <SavingsAccountEntity > = ArrayList ()
775
- Observable .from(savingsAccounts)
776
- .filter { savingsAccount ->
777
- savingsAccount.status?.active == true &&
778
- ! savingsAccount.depositType!! .isRecurring
772
+ return savingsAccounts
773
+ ?.filter { account ->
774
+ account.status?.active == true && account.depositType?.isRecurring == false
779
775
}
780
- .subscribe { savingsAccount -> accounts.add(savingsAccount) }
781
- return accounts
776
+ .orEmpty()
782
777
}
783
778
784
779
fun getActiveClients (clients : List <ClientEntity >? ): List <ClientEntity > {
785
- val accounts: MutableList <ClientEntity > = ArrayList ()
786
- Observable .from(clients)
787
- .filter { client -> client.active }
788
- .subscribe { client -> accounts.add(client) }
789
- return accounts
780
+ return clients
781
+ ?.filter { it.active }
782
+ .orEmpty()
790
783
}
791
784
792
785
fun getSyncableSavingsAccounts (savingsAccounts : List <SavingsAccountEntity >? ): List <SavingsAccountEntity > {
793
- val accounts: MutableList <SavingsAccountEntity > = ArrayList ()
794
- Observable .from(savingsAccounts)
795
- .filter { savingsAccount ->
796
- savingsAccount.depositType?.value == " Savings" &&
797
- savingsAccount.status?.active == true &&
798
- ! savingsAccount.depositType!! .isRecurring
786
+ return savingsAccounts
787
+ ?.filter { account ->
788
+ account.depositType?.value == " Savings" &&
789
+ account.status?.active == true &&
790
+ account.depositType?.isRecurring == false
799
791
}
800
- .subscribe { savingsAccount -> accounts.add(savingsAccount) }
801
- return accounts
792
+ .orEmpty()
802
793
}
803
794
}
0 commit comments