From 460e45616587343e44782544c034e94639d62e9d Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 6 May 2025 10:44:43 +0300 Subject: [PATCH] final --- ClassLibrary/Class1.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ClassLibrary/Class1.cs b/ClassLibrary/Class1.cs index c638ffb..d292fad 100644 --- a/ClassLibrary/Class1.cs +++ b/ClassLibrary/Class1.cs @@ -9,7 +9,6 @@ public class Calculations TimeSpan endWorkingTime, int consultationTime) { - // Список занятых интервалов var busy = new List<(DateTime Start, DateTime End)>(); for (int i = 0; i < startTimes.Length; i++) { @@ -18,11 +17,9 @@ public class Calculations busy.Add((start, end)); } - // Рабочее время var workStart = DateTime.Today.Add(beginWorkingTime); var workEnd = DateTime.Today.Add(endWorkingTime); - // Разбиваем на слоты var result = new List(); var current = workStart; @@ -31,7 +28,7 @@ public class Calculations var slotEnd = current.AddMinutes(consultationTime); bool isOverlapping = busy.Any(b => - current < b.End && slotEnd > b.Start // перекрытие + current < b.End && slotEnd > b.Start ); if (!isOverlapping) @@ -39,7 +36,7 @@ public class Calculations result.Add($"{current:HH:mm}-{slotEnd:HH:mm}"); } - current = slotEnd; // шаг по времени строго по длительности + current = slotEnd; } return result.ToArray();