refactor: database multi-period schedule storage

This commit is contained in:
2026-09-03 19:41:26 +03:00
parent 47ca253d6a
commit ebe1c3c4a3
20 changed files with 777 additions and 190 deletions
@@ -1,17 +1,18 @@
package agzam.vyatsu.domain.model
/**
* Расписание группы, как правило содержит 2 недели
* @author Agzam
*/
import java.time.LocalDate
data class SchedulePeriod(
val weekStart: LocalDate,
val weekEnd: LocalDate,
val season: Season
)
data class Schedule(
val groupId: String,
val season: Season,
/** Может содержать более 7 дней */
val periods: List<SchedulePeriod>,
val days: List<Day>
) {
fun periodOf(date: LocalDate): SchedulePeriod? =
periods.firstOrNull { !date.isBefore(it.weekStart) && !date.isAfter(it.weekEnd) }
}