From c77a6b565a1f1d03c5f3cf46e0223e39a9c6339f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=98=81=EC=9D=B8?= <0inn1220@gmail.com> Date: Wed, 13 Sep 2023 14:11:54 +0900 Subject: [PATCH] =?UTF-8?q?feat=20#95:=20=EB=8D=B0=EC=9D=BC=EB=A6=AC=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=91=BC=20=EC=82=AC=EB=9E=8C=20=EC=97=86?= =?UTF-8?q?=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20=EB=B6=84=EA=B8=B0=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Domain/Sources/Model/DailyStatisticsModel.swift | 2 +- .../Home/DailyTestList/DailyTestListView.swift | 12 +++++++++--- Projects/Features/Sources/Home/HomeView.swift | 2 -- Projects/Network/Sources/DTO/StatisticsDTO.swift | 7 ++++--- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Projects/Domain/Sources/Model/DailyStatisticsModel.swift b/Projects/Domain/Sources/Model/DailyStatisticsModel.swift index a7e3a368..fbba6cdf 100644 --- a/Projects/Domain/Sources/Model/DailyStatisticsModel.swift +++ b/Projects/Domain/Sources/Model/DailyStatisticsModel.swift @@ -17,7 +17,7 @@ public struct DailyStatisticsModel: Equatable { public struct TestsStatisticsModel: Hashable, Equatable { public let keymeTests: KeymeTestsInfoModel - public let avarageScore: Double + public let avarageScore: Double? } public extension StatisticsDTO { diff --git a/Projects/Features/Sources/Home/DailyTestList/DailyTestListView.swift b/Projects/Features/Sources/Home/DailyTestList/DailyTestListView.swift index 86e85594..31083275 100644 --- a/Projects/Features/Sources/Home/DailyTestList/DailyTestListView.swift +++ b/Projects/Features/Sources/Home/DailyTestList/DailyTestListView.swift @@ -98,9 +98,7 @@ extension DailyTestListView { font: .body3Semibold) .foregroundColor(.white) - Text.keyme("평균점수 | \(testStatistics.avarageScore)점", - font: .body4) - .foregroundColor(.white.opacity(0.5)) + statisticsScoreText(score: testStatistics.avarageScore) } } } @@ -108,3 +106,11 @@ extension DailyTestListView { } } } + +extension DailyTestListView { + func statisticsScoreText(score: Double?) -> some View { + Text.keyme(score != nil ? "평균점수 | \(String(describing: score))점" : "아직 아무도 풀지 않았어요", + font: .body4) + .foregroundColor(.white.opacity(0.5)) + } +} diff --git a/Projects/Features/Sources/Home/HomeView.swift b/Projects/Features/Sources/Home/HomeView.swift index 1661aded..8aed7757 100644 --- a/Projects/Features/Sources/Home/HomeView.swift +++ b/Projects/Features/Sources/Home/HomeView.swift @@ -54,7 +54,6 @@ public struct HomeView: View { } extension HomeView { - // var startTestView: some View { let startTestStore = store.scope( state: \.$startTestState, @@ -71,7 +70,6 @@ extension HomeView { } } - // 데일리 var dailyTestListView: some View { let dailyTestListStore = store.scope( state: \.$dailyTestListState, diff --git a/Projects/Network/Sources/DTO/StatisticsDTO.swift b/Projects/Network/Sources/DTO/StatisticsDTO.swift index ef4a1a30..4d2a94a3 100644 --- a/Projects/Network/Sources/DTO/StatisticsDTO.swift +++ b/Projects/Network/Sources/DTO/StatisticsDTO.swift @@ -14,7 +14,7 @@ public struct StatisticsDTO: Codable { public let data: StatisticsData public struct StatisticsData: Codable { - public let averageRate: Int + public let averageRate: Int? public let questionsStatistics: [QuestionsStatisticsData] public let solvedCount: Int } @@ -22,7 +22,8 @@ public struct StatisticsDTO: Codable { public struct QuestionsStatisticsData: Codable { public let category: Category public let keyword, title: String - public let avgScore: Double - public let myScore, questionId: Int + public let avgScore: Double? + public let questionId: Int + public let myScore: Int? } }