NTP-67538 | UPI Spend Analyser V2.1 UAT Change (#16298)
This commit is contained in:
@@ -11,6 +11,7 @@ import android.content.Context
|
||||
import com.navi.base.utils.EMPTY
|
||||
import com.navi.base.utils.formatToDecimalPlaces
|
||||
import com.navi.base.utils.formatToInrWithDecimals
|
||||
import com.navi.base.utils.orElse
|
||||
import com.navi.base.utils.orFalse
|
||||
import com.navi.base.utils.orZero
|
||||
import com.navi.common.utils.PERCENT
|
||||
@@ -125,9 +126,15 @@ class CategoryDataHelper @Inject constructor(@ApplicationContext val context: Co
|
||||
mmConfig: MMConfigResponse?,
|
||||
): List<CategorySummary> {
|
||||
val currentMonthTotalAmount =
|
||||
currentMonthCategorySummaryList.sumOf { it.totalAmount.orZero() }
|
||||
val previousMonthTotalAmount =
|
||||
previousMonthCategorySummaryList.sumOf { it.totalAmount.orZero() }
|
||||
currentMonthCategorySummaryList
|
||||
.filter { category ->
|
||||
!mmConfig
|
||||
?.categories
|
||||
?.firstOrNull { it.categoryId == category.finalCategory }
|
||||
?.isExcludedFromSpike
|
||||
.orFalse()
|
||||
}
|
||||
.sumOf { it.totalAmount.orZero() }
|
||||
|
||||
return currentMonthCategorySummaryList
|
||||
.filter { currentMonthCategorySummary ->
|
||||
@@ -165,7 +172,13 @@ class CategoryDataHelper @Inject constructor(@ApplicationContext val context: Co
|
||||
category.finalCategory == it.finalCategory
|
||||
}
|
||||
?.totalAmount
|
||||
.orZero()) / previousMonthTotalAmount
|
||||
.orZero()) /
|
||||
previousMonthCategorySummaryList
|
||||
.firstOrNull { category ->
|
||||
category.finalCategory == it.finalCategory
|
||||
}
|
||||
?.totalAmount
|
||||
.orElse(1.0)
|
||||
}
|
||||
.thenBy {
|
||||
mmConfig
|
||||
|
||||
Reference in New Issue
Block a user