Skip to content

Commit

Permalink
Fix slow generation of unbounded months
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-petrakov committed Aug 26, 2019
1 parent 18a2afd commit 2277f0f
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,7 @@ internal data class MonthConfig(

// Regroup data into 7 days.
val allDaysGroup = mutableListOf<List<CalendarDay>>()
while (allDays.isNotEmpty()) {
val sevenDays = allDays.take(7)
allDaysGroup.add(sevenDays)
allDays.removeAll(sevenDays)
}
allDaysGroup.addAll(allDays.chunked(7))

val calendarMonths = mutableListOf<CalendarMonth>()
val calMonthsCount = allDaysGroup.size roundDiv maxRowCount
Expand Down

0 comments on commit 2277f0f

Please sign in to comment.