From 358ee8c6ca528a4d4d15b9cfc07fbc14721407f2 Mon Sep 17 00:00:00 2001 From: andchiind Date: Wed, 18 Dec 2024 14:49:58 +0100 Subject: [PATCH] Remove unneeded nullability in event args --- backend/api/EventHandlers/MissionEventHandler.cs | 4 ++-- backend/api/Services/Events/MissionEventArgs.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/api/EventHandlers/MissionEventHandler.cs b/backend/api/EventHandlers/MissionEventHandler.cs index 9a19a3535..2dfecd427 100644 --- a/backend/api/EventHandlers/MissionEventHandler.cs +++ b/backend/api/EventHandlers/MissionEventHandler.cs @@ -114,7 +114,7 @@ private async void OnSendRobotToDockTriggered(object? sender, RobotEmergencyEven return; } - try { await RobotService.UpdateFlotillaStatus(e.RobotId, e.RobotFlotillaStatus ?? RobotFlotillaStatus.Normal); } + try { await RobotService.UpdateFlotillaStatus(e.RobotId, e.RobotFlotillaStatus); } catch (Exception ex) { _logger.LogError("Was not able to update Robot Flotilla status for robot {RobotId}, {ErrorMessage}", e.RobotId, ex.Message); @@ -179,7 +179,7 @@ private async void OnReleaseRobotFromDockTriggered(object? sender, RobotEmergenc robot.MissionQueueFrozen = false; - try { await RobotService.UpdateFlotillaStatus(e.RobotId, e.RobotFlotillaStatus ?? RobotFlotillaStatus.Normal); } + try { await RobotService.UpdateFlotillaStatus(e.RobotId, e.RobotFlotillaStatus); } catch (Exception ex) { _logger.LogError("Was not able to update Robot Flotilla status for robot {RobotId}, {ErrorMessage}", e.RobotId, ex.Message); diff --git a/backend/api/Services/Events/MissionEventArgs.cs b/backend/api/Services/Events/MissionEventArgs.cs index 6f72ad3db..14e59c01f 100644 --- a/backend/api/Services/Events/MissionEventArgs.cs +++ b/backend/api/Services/Events/MissionEventArgs.cs @@ -12,10 +12,10 @@ public class RobotAvailableEventArgs(string robotId) : EventArgs public string RobotId { get; } = robotId; } - public class RobotEmergencyEventArgs(string robotId, RobotFlotillaStatus? robotFlotillaStatus = null) : EventArgs + public class RobotEmergencyEventArgs(string robotId, RobotFlotillaStatus robotFlotillaStatus) : EventArgs { public string RobotId { get; } = robotId; - public RobotFlotillaStatus? RobotFlotillaStatus { get; } = robotFlotillaStatus; + public RobotFlotillaStatus RobotFlotillaStatus { get; } = robotFlotillaStatus; } public class TeamsMessageEventArgs(string teamsMessage) : EventArgs