diff --git a/src/Jiaowu.Api/Infrastructure/Scheduling/AutomaticScheduleGenerator.cs b/src/Jiaowu.Api/Infrastructure/Scheduling/AutomaticScheduleGenerator.cs index 632fbaf..b5db91e 100644 --- a/src/Jiaowu.Api/Infrastructure/Scheduling/AutomaticScheduleGenerator.cs +++ b/src/Jiaowu.Api/Infrastructure/Scheduling/AutomaticScheduleGenerator.cs @@ -680,6 +680,8 @@ public sealed class AutomaticScheduleGenerator(AppDbContext db) { var start = Math.Max(first.StartWeek, second.StartWeek); var end = Math.Min(first.EndWeek, second.EndWeek); + if (start > end) return false; + return Enumerable.Range(start, end - start + 1).Any(week => IncludesWeek(first.WeekPattern, week) && IncludesWeek(second.WeekPattern, week)); }