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? } }