Skip to content

Commit

Permalink
Log if missionrun has no inspectionarea
Browse files Browse the repository at this point in the history
  • Loading branch information
andchiind committed Dec 18, 2024
1 parent 1739672 commit 8decb94
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion backend/api/Services/MissionSchedulingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,17 @@ public async Task StartNextMissionRunIfSystemIsAvailable(Robot robot)
return;
}

if (missionRun.InspectionArea == null)
{
logger.LogWarning("Mission {MissionRunId} does not have an inspection area and was therefore not started", missionRun.Id);
return;
}

if (robot.CurrentInspectionArea == null && missionRun.InspectionArea != null)
{
await robotService.UpdateCurrentInspectionArea(robot.Id, missionRun.InspectionArea.Id);
}
else if (!await localizationService.RobotIsOnSameDeckAsMission(robot.Id, missionRun.InspectionArea!.Id))
else if (!await localizationService.RobotIsOnSameDeckAsMission(robot.Id, missionRun.InspectionArea.Id))

Check failure on line 87 in backend/api/Services/MissionSchedulingService.cs

View workflow job for this annotation

GitHub Actions / test_backend

Dereference of a possibly null reference.

Check failure on line 87 in backend/api/Services/MissionSchedulingService.cs

View workflow job for this annotation

GitHub Actions / test_backend

Dereference of a possibly null reference.

Check warning on line 87 in backend/api/Services/MissionSchedulingService.cs

View workflow job for this annotation

GitHub Actions / build_backend

Dereference of a possibly null reference.

Check warning on line 87 in backend/api/Services/MissionSchedulingService.cs

View workflow job for this annotation

GitHub Actions / build_backend

Dereference of a possibly null reference.
{
logger.LogError("Robot {RobotId} is not on the same deck as the mission run {MissionRunId}. Aborting all mission runs", robot.Id, missionRun.Id);
try { await AbortAllScheduledMissions(robot.Id, "Aborted: Robot was at different deck"); }
Expand Down

0 comments on commit 8decb94

Please sign in to comment.