From dbe69265b7db997dcc350a0f1d65dd5fa0387b31 Mon Sep 17 00:00:00 2001 From: Davin Byeon Date: Fri, 23 Feb 2024 14:25:09 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BB=A4=EC=8A=A4=ED=85=80=20=ED=85=8C?= =?UTF-8?q?=EB=A7=88=20=EC=97=90=EB=9F=AC=20=EC=BC=80=EC=9D=B4=EC=8A=A4=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EB=A1=9C=EA=B9=85=20(#226)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/timetables/service/TimetableThemeService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/timetables/service/TimetableThemeService.kt b/core/src/main/kotlin/timetables/service/TimetableThemeService.kt index b224ccfa..9b43eef3 100644 --- a/core/src/main/kotlin/timetables/service/TimetableThemeService.kt +++ b/core/src/main/kotlin/timetables/service/TimetableThemeService.kt @@ -238,7 +238,8 @@ class TimetableThemeServiceImpl( val theme = getTheme(timetable.userId, timetable.themeId) val alreadyUsedColors = timetable.lectures.map { requireNotNull(it.color) } - val colorToCount = requireNotNull(theme.colors).associateWith { color -> alreadyUsedColors.count { it == color } } + val colors = requireNotNull(theme.colors) { "theme.colors 가 null - userId: ${timetable.userId}, timetableId: ${timetable.id}, themeId: ${theme.id}" } + val colorToCount = colors.associateWith { color -> alreadyUsedColors.count { it == color } } val minCount = colorToCount.minOf { it.value } 0 to colorToCount.entries.filter { (_, count) -> count == minCount }.map { it.key }.random()