Skip to content

Commit

Permalink
Only reschedule missions if they did not complete
Browse files Browse the repository at this point in the history
  • Loading branch information
andchiind committed Oct 25, 2024
1 parent b98b123 commit 899d585
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions backend/api/Services/MissionSchedulingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,14 @@ private async Task MoveInterruptedMissionsToQueue(IEnumerable<string> interrupte
return;
}

var unfinishedTasks = missionRun.Tasks
.Where(t => !new List<Database.Models.TaskStatus>
{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,
Expand All @@ -397,11 +405,7 @@ private async Task MoveInterruptedMissionsToQueue(IEnumerable<string> interrupte
Area = missionRun.Area,
Status = MissionStatus.Pending,
DesiredStartTime = DateTime.UtcNow,
Tasks = missionRun.Tasks
.Where(t => !new List<Database.Models.TaskStatus>
{Database.Models.TaskStatus.Successful, Database.Models.TaskStatus.Failed}
.Contains(t.Status))
.Select(t => new MissionTask(t)).ToList(),
Tasks = unfinishedTasks,
Map = new MapMetadata()
};

Expand Down

0 comments on commit 899d585

Please sign in to comment.