From 6003af86f6656a72070b54be4895a3e21e8ed95e Mon Sep 17 00:00:00 2001 From: viratde Date: Sat, 26 Oct 2024 09:17:30 +0530 Subject: [PATCH 1/4] Realated transaction repository functions were not loading, now added --- .idea/inspectionProfiles/Project_Default.xml | 57 +++++++++++++++++++ .idea/runConfigurations.xml | 17 ++++++ .../data/repository/TransactionRepository.kt | 39 +++++++------ 3 files changed, 97 insertions(+), 16 deletions(-) create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/runConfigurations.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000..cde3e1999f --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,57 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000000..16660f1d80 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt b/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt index 5481ef929c..e41ac771b5 100644 --- a/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt +++ b/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt @@ -97,29 +97,36 @@ class TransactionRepository @Inject constructor( accountId: AccountId, startDate: Instant, endDate: Instant - ): List = retrieveTrns( - dbCall = { - transactionDao.findAllByAccountAndBetween( - accountId = accountId.value, - startDate = startDate, - endDate = endDate - ) + ): List = withContext(dispatchersProvider.io) { + val transactions = transactionDao.findAllByAccountAndBetween( + accountId = accountId.value, + startDate = startDate, + endDate = endDate + ) + val tagAssociationMap = getTagsForTransactionIds(transactions) + transactions.mapNotNull { + val tags = tagAssociationMap[it.id] ?: emptyList() + with(mapper) { it.toDomain(tags = tags).getOrNull() } } - ) + } suspend fun findAllToAccountAndBetween( toAccountId: AccountId, startDate: Instant, endDate: Instant - ): List = retrieveTrns( - dbCall = { - transactionDao.findAllToAccountAndBetween( - toAccountId = toAccountId.value, - startDate = startDate, - endDate = endDate - ) + ): List = withContext(dispatchersProvider.io) { + val transactions = transactionDao.findAllToAccountAndBetween( + toAccountId = toAccountId.value, + startDate = startDate, + endDate = endDate + ) + val tagAssociationMap = getTagsForTransactionIds(transactions) + transactions.mapNotNull { + val tags = tagAssociationMap[it.id] ?: emptyList() + with(mapper) { it.toDomain(tags = tags).getOrNull() } } - ) + } + suspend fun findAllDueToBetween( startDate: Instant, From 24e091fdcfa8b81444429da98937e8533abb3383 Mon Sep 17 00:00:00 2001 From: viratde Date: Sat, 26 Oct 2024 09:31:52 +0530 Subject: [PATCH 2/4] Removed idea files and corrected formatting --- .idea/inspectionProfiles/Project_Default.xml | 57 ------------------- .idea/runConfigurations.xml | 17 ------ .../data/repository/TransactionRepository.kt | 1 - 3 files changed, 75 deletions(-) delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index cde3e1999f..0000000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 16660f1d80..0000000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt b/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt index e41ac771b5..7df3ae51c4 100644 --- a/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt +++ b/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt @@ -127,7 +127,6 @@ class TransactionRepository @Inject constructor( } } - suspend fun findAllDueToBetween( startDate: Instant, endDate: Instant From ce6e9f72d953690fba4db5e8f5c49b21445a852f Mon Sep 17 00:00:00 2001 From: viratde Date: Wed, 30 Oct 2024 11:14:22 +0530 Subject: [PATCH 3/4] Used retrieveTrans --- .idea/runConfigurations.xml | 17 +++++++ .../data/repository/TransactionRepository.kt | 46 ++++++++++--------- 2 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 .idea/runConfigurations.xml diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000000..16660f1d80 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt b/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt index 7df3ae51c4..c29e31ac11 100644 --- a/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt +++ b/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt @@ -97,35 +97,37 @@ class TransactionRepository @Inject constructor( accountId: AccountId, startDate: Instant, endDate: Instant - ): List = withContext(dispatchersProvider.io) { - val transactions = transactionDao.findAllByAccountAndBetween( - accountId = accountId.value, - startDate = startDate, - endDate = endDate - ) - val tagAssociationMap = getTagsForTransactionIds(transactions) - transactions.mapNotNull { - val tags = tagAssociationMap[it.id] ?: emptyList() - with(mapper) { it.toDomain(tags = tags).getOrNull() } + ): List = retrieveTrns( + dbCall = { + transactionDao.findAllByAccountAndBetween( + accountId = accountId.value, + startDate = startDate, + endDate = endDate + ) + }, + retrieveTags = { + getTagsForTransactionIds(listOf(it))[it.id] ?: emptyList() } - } + ) + + suspend fun findAllToAccountAndBetween( toAccountId: AccountId, startDate: Instant, endDate: Instant - ): List = withContext(dispatchersProvider.io) { - val transactions = transactionDao.findAllToAccountAndBetween( - toAccountId = toAccountId.value, - startDate = startDate, - endDate = endDate - ) - val tagAssociationMap = getTagsForTransactionIds(transactions) - transactions.mapNotNull { - val tags = tagAssociationMap[it.id] ?: emptyList() - with(mapper) { it.toDomain(tags = tags).getOrNull() } + ): List = retrieveTrns( + dbCall = { + transactionDao.findAllToAccountAndBetween( + toAccountId = toAccountId.value, + startDate = startDate, + endDate = endDate + ) + }, + retrieveTags = { + getTagsForTransactionIds(listOf(it))[it.id] ?: emptyList() } - } + ) suspend fun findAllDueToBetween( startDate: Instant, From 4ef3c9cd0c82a46ccdec150126ce37b64d079039 Mon Sep 17 00:00:00 2001 From: viratde Date: Sat, 2 Nov 2024 07:18:44 +0530 Subject: [PATCH 4/4] Removed Extra Consecutive lines --- .../main/java/com/ivy/data/repository/TransactionRepository.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt b/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt index c29e31ac11..809815fcde 100644 --- a/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt +++ b/shared/data/core/src/main/java/com/ivy/data/repository/TransactionRepository.kt @@ -110,8 +110,6 @@ class TransactionRepository @Inject constructor( } ) - - suspend fun findAllToAccountAndBetween( toAccountId: AccountId, startDate: Instant,