Skip to content

Commit

Permalink
Try to assign map to mission if no existing map
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddasol committed Jan 15, 2025
1 parent 54e5d45 commit cbc6e6e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions backend/api/Controllers/MissionSchedulingController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,19 @@ await localizationService.EnsureRobotIsOnSameInstallationAsMission(
InspectionArea = missionDefinition.InspectionArea,
};

if (missionDefinition.Map == null)
{
var newMap = await mapService.ChooseMapFromMissionRunTasks(missionRun);
if (newMap != null)
{
logger.LogInformation(
$"Assigned map {newMap.MapName} to mission definition with id {missionDefinition.Id}"
);
missionDefinition.Map = newMap;
await missionDefinitionService.Update(missionDefinition);
}
}

if (missionRun.Tasks.Any())
{
missionRun.CalculateEstimatedDuration();
Expand Down

0 comments on commit cbc6e6e

Please sign in to comment.