From 4053e90b4c32acb9536a85a21bbf04b37344b022 Mon Sep 17 00:00:00 2001 From: oysand Date: Mon, 24 Jun 2024 14:16:53 +0200 Subject: [PATCH] Add debug log --- backend/api/Services/MissionSchedulingService.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/api/Services/MissionSchedulingService.cs b/backend/api/Services/MissionSchedulingService.cs index 8c714edfb..572ad852b 100644 --- a/backend/api/Services/MissionSchedulingService.cs +++ b/backend/api/Services/MissionSchedulingService.cs @@ -72,7 +72,17 @@ public async Task StartNextMissionRunIfSystemIsAvailable(string robotId) logger.LogError("Failed to schedule a return to home mission for robot {RobotId}", robot.Id); await robotService.UpdateCurrentArea(robot.Id, null); } + if (missionRun == null) { return; } // The robot is already home + + var postReturnToHomeMissionCreatedRobot = await robotService.ReadById(missionRun.Robot.Id); + if (postReturnToHomeMissionCreatedRobot == null) + { + logger.LogInformation("Could not find robot {Name}", missionRun.Robot.Name); + return; + } + + logger.LogInformation("Post return to home mission created: Robot {robotName} has status {robotStatus} and current area {areaName}", postReturnToHomeMissionCreatedRobot.Name, postReturnToHomeMissionCreatedRobot.Status, postReturnToHomeMissionCreatedRobot.CurrentArea?.Name); } if (!await TheSystemIsAvailableToRunAMission(robot.Id, missionRun.Id))