Skip to content

Commit 71e8668

Browse files
committed
refactor: 히트맵 주차 수 계산에서 불필요한 필터링 제거
1 parent 6428803 commit 71e8668

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

DevLog/UI/Profile/HeatmapView.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,11 @@ private struct HeatmapLayout {
7979
let monthTitleSpacing: CGFloat = 6
8080

8181
init(availableWidth: CGFloat, weekCounts: [Int]) {
82-
let sanitizedWeekCounts = weekCounts.filter { 0 < $0 }
83-
let totalColumns = max(sanitizedWeekCounts.reduce(0, +), 1)
84-
let totalColumnSpacings = sanitizedWeekCounts.reduce(0) { partialResult, count in
82+
let totalColumns = max(weekCounts.reduce(0, +), 1)
83+
let totalColumnSpacings = weekCounts.reduce(0) { partialResult, count in
8584
partialResult + max(count - 1, 0)
8685
}
87-
let fixedWidth = monthSpacing * CGFloat(max(sanitizedWeekCounts.count - 1, 0))
86+
let fixedWidth = monthSpacing * CGFloat(max(weekCounts.count - 1, 0))
8887
+ cellSpacing * CGFloat(totalColumnSpacings)
8988
cellSize = max(0, availableWidth - fixedWidth) / CGFloat(totalColumns)
9089
}

0 commit comments

Comments
 (0)