From f2938868952694bc408dbf8a82d478b9ede6709f Mon Sep 17 00:00:00 2001 From: MadhavBhavsar Date: Mon, 12 Feb 2024 17:20:48 +0530 Subject: [PATCH 1/2] fix-issue-2940 --- .../src/main/java/com/ivy/categories/CategoriesViewModel.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/screen/categories/src/main/java/com/ivy/categories/CategoriesViewModel.kt b/screen/categories/src/main/java/com/ivy/categories/CategoriesViewModel.kt index 02af4e0c69..b5de92eb24 100644 --- a/screen/categories/src/main/java/com/ivy/categories/CategoriesViewModel.kt +++ b/screen/categories/src/main/java/com/ivy/categories/CategoriesViewModel.kt @@ -200,8 +200,9 @@ class CategoriesViewModel @Inject constructor( } SortOrder.BALANCE_AMOUNT -> categoryData.sortedByDescending { - it.monthlyBalance.absoluteValue - } + it.monthlyBalance + }.partition { it.monthlyBalance.toInt() != 0 } // Partition into non-zero and zero lists + .let { (nonZero, zero) -> nonZero + zero } SortOrder.ALPHABETICAL -> categoryData.sortedBy { it.category.name From ed3714c4b7724f994a7e7a5e6c975b66da089a4b Mon Sep 17 00:00:00 2001 From: MadhavBhavsar Date: Mon, 12 Feb 2024 17:51:43 +0530 Subject: [PATCH 2/2] fix-issue-2940 --- .../src/main/java/com/ivy/categories/CategoriesViewModel.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/screen/categories/src/main/java/com/ivy/categories/CategoriesViewModel.kt b/screen/categories/src/main/java/com/ivy/categories/CategoriesViewModel.kt index b5de92eb24..51fda3d7d5 100644 --- a/screen/categories/src/main/java/com/ivy/categories/CategoriesViewModel.kt +++ b/screen/categories/src/main/java/com/ivy/categories/CategoriesViewModel.kt @@ -30,7 +30,6 @@ import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.launch import javax.inject.Inject -import kotlin.math.absoluteValue @HiltViewModel class CategoriesViewModel @Inject constructor(