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
@@ -152,10 +152,13 @@ public sealed class FileSystemMediaStorage(MediaPathResolver paths) : IMediaStor
private static void DeleteCompanions(string directory, CompanionMatcher companion)
{
foreach (var file in Directory.EnumerateFiles(directory))
var companions = Directory
.EnumerateFiles(directory)
.Where(file => companion.Matches(Path.GetFileName(file)))
.ToList();
foreach (var file in companions)
{
if (!companion.Matches(Path.GetFileName(file)))
continue;
try
{
File.Delete(file);