Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
davin111 committed Feb 23, 2024
1 parent 1649592 commit 8913953
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 8913953

Please sign in to comment.