Skip to content

Commit

Permalink
Excluding the transfers from the pie chart
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuppan committed Jan 26, 2025
1 parent 124fc00 commit 6df403d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.naveenapps.expensemanager.core.model.CategoryTransactionState
import com.naveenapps.expensemanager.core.model.CategoryType
import com.naveenapps.expensemanager.core.model.PieChartData
import com.naveenapps.expensemanager.core.model.getDummyPieChartData
import com.naveenapps.expensemanager.core.model.isTransfer
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.firstOrNull
Expand All @@ -29,7 +30,7 @@ class GetTransactionGroupByCategoryUseCase @Inject constructor(
) { currency, transactions ->

val maps = if (transactions?.isNotEmpty() == true) {
transactions.groupBy { it.categoryId }
transactions.filterNot { it.type.isTransfer() }.groupBy { it.categoryId }
.map { it.value[0].category to it.value }.toMap()
} else {
emptyMap()
Expand Down

0 comments on commit 6df403d

Please sign in to comment.