Refactor GenerateGridCommandHandler and GridPlanner for improved slot management and readability
ci / build-backend (push) Successful in 2m45s
ci / build-frontend (push) Successful in 1m11s
ci / tests (push) Successful in 2m45s
ci / sonar (push) Successful in 6m33s

Updated the GenerateGridCommandHandler to streamline slot removal during grid generation by introducing a new RemoveAllSlots method. Enhanced the GridPlanner class by refactoring the FillDay method to utilize a SlotTarget struct for better clarity and organization. These changes improve code maintainability and readability while ensuring efficient slot handling across grid generation processes.
This commit is contained in:
Leonid Pershin
2026-07-27 09:08:20 +03:00
parent f22aee4685
commit b8d6b6aad2
6 changed files with 155 additions and 116 deletions
@@ -212,9 +212,9 @@ public sealed class ValidateTemplateQueryHandler(
{
var slots = layers.SelectMany(l => l.Slots).ToList();
foreach (var weekday in GridCoverage.Week)
foreach (var (from, to) in GridCoverage.Gaps(slots, weekday, dayStart))
yield return Gap(weekday, from, to, dayStart);
return from weekday in GridCoverage.Week
from gap in GridCoverage.Gaps(slots, weekday, dayStart)
select Gap(weekday, gap.From, gap.To, dayStart);
}
private static TemplateIssueDto Gap(int weekday, int from, int to, TimeOnly dayStart)