From e993727112f48b6b8ac71c322ecf1ca85249b5ac Mon Sep 17 00:00:00 2001 From: yangsooplus Date: Sat, 10 Feb 2024 21:14:45 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix/QA-20:=20=ED=86=B5=EA=B3=84=20=EC=B4=9D?= =?UTF-8?q?=20=EA=B8=88=EC=95=A1=EC=9D=84=20N=EB=A7=8C=EC=9B=90=20?= =?UTF-8?q?=EB=8B=A8=EC=9C=84=EB=A1=9C=20=EA=B0=80=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/StatisticsRepositoryImpl.kt | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/data/src/main/java/com/susu/data/data/repository/StatisticsRepositoryImpl.kt b/data/src/main/java/com/susu/data/data/repository/StatisticsRepositoryImpl.kt index f84b693f..eb7ea300 100644 --- a/data/src/main/java/com/susu/data/data/repository/StatisticsRepositoryImpl.kt +++ b/data/src/main/java/com/susu/data/data/repository/StatisticsRepositoryImpl.kt @@ -14,7 +14,12 @@ class StatisticsRepositoryImpl @Inject constructor( override suspend fun getMyStatistics(): MyStatistics { val originalStatistic = statisticsService.getMyStatistics().getOrThrow().toModel() val sortedRecentSpent = originalStatistic.recentSpent.sortedBy { it.title.toInt() } - .map { StatisticsElement(title = it.title.substring(it.title.length - 2).toInt().toString(), value = it.value) } + .map { + StatisticsElement( + title = it.title.substring(it.title.length - 2).toInt().toString(), + value = it.value / 10000, + ) + } return MyStatistics( highestAmountReceived = originalStatistic.highestAmountReceived, @@ -23,8 +28,8 @@ class StatisticsRepositoryImpl @Inject constructor( mostRelationship = originalStatistic.mostRelationship, mostSpentMonth = originalStatistic.mostSpentMonth % 100, recentSpent = sortedRecentSpent, - recentTotalSpent = originalStatistic.recentTotalSpent, - recentMaximumSpent = originalStatistic.recentMaximumSpent, + recentTotalSpent = sortedRecentSpent.sumOf { it.value }, + recentMaximumSpent = sortedRecentSpent.maxOfOrNull { it.value } ?: 0, ) } @@ -35,7 +40,12 @@ class StatisticsRepositoryImpl @Inject constructor( categoryId = categoryId, ).getOrThrow().toModel() val sortedRecentSpent = originalStatistic.recentSpent.sortedBy { it.title.toInt() } - .map { StatisticsElement(title = it.title.substring(it.title.length - 2).toInt().toString(), value = it.value) } + .map { + StatisticsElement( + title = it.title.substring(it.title.length - 2).toInt().toString(), + value = it.value / 10000, + ) + } return SusuStatistics( averageSent = originalStatistic.averageSent, @@ -45,8 +55,8 @@ class StatisticsRepositoryImpl @Inject constructor( mostSpentMonth = originalStatistic.mostSpentMonth % 100, mostRelationship = originalStatistic.mostRelationship, mostCategory = originalStatistic.mostCategory, - recentTotalSpent = originalStatistic.recentTotalSpent, - recentMaximumSpent = originalStatistic.recentMaximumSpent, + recentTotalSpent = sortedRecentSpent.sumOf { it.value }, + recentMaximumSpent = sortedRecentSpent.maxOfOrNull { it.value } ?: 0, ) } } From 5f5a5198beee2c1f991bf5b3b2f8a36cdc199157 Mon Sep 17 00:00:00 2001 From: yangsooplus Date: Sat, 10 Feb 2024 21:17:12 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix/QA-29:=20=ED=86=B5=EA=B3=84=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=ED=95=98=EB=8B=A8=20=EC=97=AC=EB=B0=B1=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../susu/feature/statistics/content/my/MyStatisticsContent.kt | 2 ++ .../feature/statistics/content/susu/SusuStatisticsContent.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/feature/statistics/src/main/java/com/susu/feature/statistics/content/my/MyStatisticsContent.kt b/feature/statistics/src/main/java/com/susu/feature/statistics/content/my/MyStatisticsContent.kt index 5ce22d53..6e25298f 100644 --- a/feature/statistics/src/main/java/com/susu/feature/statistics/content/my/MyStatisticsContent.kt +++ b/feature/statistics/src/main/java/com/susu/feature/statistics/content/my/MyStatisticsContent.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState @@ -133,6 +134,7 @@ fun MyStatisticsContent( money = uiState.statistics.highestAmountSent.value, isActive = !isBlind, ) + Spacer(modifier = Modifier.height(SusuTheme.spacing.spacing_xxxl)) } if (uiState.isLoading) { diff --git a/feature/statistics/src/main/java/com/susu/feature/statistics/content/susu/SusuStatisticsContent.kt b/feature/statistics/src/main/java/com/susu/feature/statistics/content/susu/SusuStatisticsContent.kt index 5fdbd307..666646d0 100644 --- a/feature/statistics/src/main/java/com/susu/feature/statistics/content/susu/SusuStatisticsContent.kt +++ b/feature/statistics/src/main/java/com/susu/feature/statistics/content/susu/SusuStatisticsContent.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState @@ -184,6 +185,7 @@ fun SusuStatisticsScreen( isActive = !isBlind, ) } + Spacer(modifier = Modifier.height(SusuTheme.spacing.spacing_xxxl)) } if (uiState.isAgeSheetOpen) { From f0e4f7d47c983f14f05a8573de227ed5ad39bf53 Mon Sep 17 00:00:00 2001 From: yangsooplus Date: Sat, 10 Feb 2024 21:19:29 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix/QA-31:=20=ED=86=B5=EA=B3=84=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20'=EC=B4=9D'=20=EC=9B=8C=EB=94=A9=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/susu/feature/statistics/component/RecentSpentGraph.kt | 3 +-- feature/statistics/src/main/res/values/strings.xml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/feature/statistics/src/main/java/com/susu/feature/statistics/component/RecentSpentGraph.kt b/feature/statistics/src/main/java/com/susu/feature/statistics/component/RecentSpentGraph.kt index 06f0d64a..60fbb9fc 100644 --- a/feature/statistics/src/main/java/com/susu/feature/statistics/component/RecentSpentGraph.kt +++ b/feature/statistics/src/main/java/com/susu/feature/statistics/component/RecentSpentGraph.kt @@ -86,12 +86,11 @@ fun RecentSpentGraph( number = totalAmount, style = SusuTheme.typography.title_xs, color = Blue60, - prefix = stringResource(id = R.string.statistics_total_man_prefix), postfix = stringResource(id = R.string.statistics_total_man_postfix), ) } else { Text( - text = stringResource(R.string.statistics_total_man_format, stringResource(R.string.word_unknown)), + text = stringResource(R.string.statistics_man_format, stringResource(R.string.word_unknown)), style = SusuTheme.typography.title_xs, color = Gray40, ) diff --git a/feature/statistics/src/main/res/values/strings.xml b/feature/statistics/src/main/res/values/strings.xml index cbdb3a0f..2d051a72 100644 --- a/feature/statistics/src/main/res/values/strings.xml +++ b/feature/statistics/src/main/res/values/strings.xml @@ -1,7 +1,7 @@ 최근 8개월 간 쓴 금액 - 총 %s만원 + %s만원 만원 나의 수수 From e49c15e3e446be6e73c27bad6d5d10c2b597afd7 Mon Sep 17 00:00:00 2001 From: yangsooplus Date: Sat, 10 Feb 2024 21:29:49 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix/QA-39:=20=ED=86=B5=EA=B3=84=20=EA=B7=B8?= =?UTF-8?q?=EB=9E=98=ED=94=84=20=EA=B8=B0=EA=B0=84=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?-=20=EC=98=AC=ED=95=B4=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EA=B0=80?= =?UTF-8?q?=20=EC=95=84=EB=8B=8C=20=EA=B2=83=EC=9D=80=20=EB=B3=B4=EC=97=AC?= =?UTF-8?q?=EC=A3=BC=EC=A7=80=20=EC=95=8A=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/repository/StatisticsRepositoryImpl.kt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/data/src/main/java/com/susu/data/data/repository/StatisticsRepositoryImpl.kt b/data/src/main/java/com/susu/data/data/repository/StatisticsRepositoryImpl.kt index eb7ea300..f2c2eb3e 100644 --- a/data/src/main/java/com/susu/data/data/repository/StatisticsRepositoryImpl.kt +++ b/data/src/main/java/com/susu/data/data/repository/StatisticsRepositoryImpl.kt @@ -13,13 +13,17 @@ class StatisticsRepositoryImpl @Inject constructor( ) : StatisticsRepository { override suspend fun getMyStatistics(): MyStatistics { val originalStatistic = statisticsService.getMyStatistics().getOrThrow().toModel() - val sortedRecentSpent = originalStatistic.recentSpent.sortedBy { it.title.toInt() } + val sortedRecentSpent = originalStatistic.recentSpent + .filter { + currentYear == it.title.substring(0 until 4).toInt() + } .map { StatisticsElement( title = it.title.substring(it.title.length - 2).toInt().toString(), value = it.value / 10000, ) } + .sortedBy { it.title.toInt() } return MyStatistics( highestAmountReceived = originalStatistic.highestAmountReceived, @@ -39,13 +43,17 @@ class StatisticsRepositoryImpl @Inject constructor( relationshipId = relationshipId, categoryId = categoryId, ).getOrThrow().toModel() - val sortedRecentSpent = originalStatistic.recentSpent.sortedBy { it.title.toInt() } + val sortedRecentSpent = originalStatistic.recentSpent + .filter { + currentYear == it.title.substring(0 until 4).toInt() + } .map { StatisticsElement( title = it.title.substring(it.title.length - 2).toInt().toString(), value = it.value / 10000, ) } + .sortedBy { it.title.toInt() } return SusuStatistics( averageSent = originalStatistic.averageSent, @@ -59,4 +67,8 @@ class StatisticsRepositoryImpl @Inject constructor( recentMaximumSpent = sortedRecentSpent.maxOfOrNull { it.value } ?: 0, ) } + + companion object { + private val currentYear = java.time.LocalDate.now().year + } }