Files
TeleWave/backend/src/TeleWave.Application/Programming/Templates/Generate/GridPlan.cs
T
Leonid Pershin 96ff2cc7ab
ci / build-backend (push) Successful in 2m45s
ci / build-frontend (push) Successful in 1m12s
ci / tests (push) Successful in 2m52s
ci / sonar (push) Successful in 8m13s
Implement interval intersection and subtraction methods in GridCoverage, update GridPlan and related DTOs for PlanNote integration
Added new methods for intersecting and subtracting time intervals in the GridCoverage class to enhance scheduling capabilities. Updated the GridPlan and GridPlanDto classes to replace string notes with a structured PlanNote type, improving note management. Enhanced the GridPlanner class to utilize these new features, ensuring better handling of scheduling conflicts and notes during grid generation. Adjusted related tests to validate the new functionality.
2026-07-27 11:36:06 +03:00

62 lines
2.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using TeleWave.Domain.Programming;
namespace TeleWave.Application.Programming.Templates.Generate;
/// <summary>Что делать с тем, что в сетке уже есть.</summary>
public enum GridGenerationMode
{
/// <summary>Только незакрытые интервалы; ручные слоты не трогаются.</summary>
FillGaps = 0,
/// <summary>Снести все слоты шаблона и построить неделю заново.</summary>
Rebuild = 1,
}
/// <summary>Куда ложится слот. Имена слоёв — в <see cref="GridPlanner"/>.</summary>
public enum GridPlanLayer
{
Main = 0,
Weekend = 1,
}
/// <summary>
/// Будущий слот: то же, что <see cref="SlotInput"/>, но без слоя и идентификаторов. Сравнивается
/// по значению — на этом держится схлопывание одинаковых дней в один слот «каждый день».
/// </summary>
public sealed record PlannedSlot(
GridPlanLayer Layer,
int? Weekday,
TimeOnly Start,
int DurationMinutes,
string Title,
Daypart Daypart,
SlotKind SlotKind,
Guid? GroupId,
string? GroupName,
SlotBlockMode BlockMode,
int BlockValue,
SlotStrategy? Strategy,
RepeatSource? RepeatSource,
/// <summary>Жёсткий старт. Ставится в начале прайма: кино должно начинаться в объявленное время.</summary>
bool IsAnchor
);
/// <summary>
/// Результат разбора: что будет создано, что снесено и о чём стоит знать заранее. Считается и для
/// предпросмотра, и для самой генерации — одним и тем же кодом, поэтому показанное совпадает
/// с созданным.
/// </summary>
/// <param name="FreeMinutes">Сколько минут недели генератор считал свободными.</param>
/// <param name="CoveredMinutes">Сколько из них закрыто слотами плана.</param>
public sealed record GridPlan(
GridProfile Profile,
GridGenerationMode Mode,
IReadOnlyList<PlannedSlot> Slots,
IReadOnlyList<PlanNote> Notes,
int SlotsToRemove,
Guid? FallbackGroupId,
string? FallbackGroupName,
int FreeMinutes,
int CoveredMinutes
);