diff --git a/backend/api/Services/MissionSchedulingService.cs b/backend/api/Services/MissionSchedulingService.cs index 09d0ab66f..eac7c87c9 100644 --- a/backend/api/Services/MissionSchedulingService.cs +++ b/backend/api/Services/MissionSchedulingService.cs @@ -388,6 +388,14 @@ private async Task MoveInterruptedMissionsToQueue(IEnumerable interrupte return; } + var unfinishedTasks = missionRun.Tasks + .Where(t => !new List + {Database.Models.TaskStatus.Successful, Database.Models.TaskStatus.Failed} + .Contains(t.Status)) + .Select(t => new MissionTask(t)).ToList(); + + if (unfinishedTasks.Count == 0) continue; + var newMissionRun = new MissionRun { Name = missionRun.Name, @@ -397,11 +405,7 @@ private async Task MoveInterruptedMissionsToQueue(IEnumerable interrupte Area = missionRun.Area, Status = MissionStatus.Pending, DesiredStartTime = DateTime.UtcNow, - Tasks = missionRun.Tasks - .Where(t => !new List - {Database.Models.TaskStatus.Successful, Database.Models.TaskStatus.Failed} - .Contains(t.Status)) - .Select(t => new MissionTask(t)).ToList(), + Tasks = unfinishedTasks, Map = new MapMetadata() };