From d0a9ebbd4311b21466c57fcc9087970173ff08d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Fadum?= Date: Mon, 29 Jul 2024 14:36:42 +0200 Subject: [PATCH] Fix last successful mission run update --- backend/api/Services/MissionDefinitionService.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/api/Services/MissionDefinitionService.cs b/backend/api/Services/MissionDefinitionService.cs index b76e8c4ac..822a299eb 100644 --- a/backend/api/Services/MissionDefinitionService.cs +++ b/backend/api/Services/MissionDefinitionService.cs @@ -119,6 +119,11 @@ public async Task UpdateLastSuccessfulMissionRun(string missi logger.LogWarning("{Message}", errorMessage); throw new MissionNotFoundException(errorMessage); } + if (missionRun.Status == MissionStatus.Successful) + { + missionDefinition.LastSuccessfulRun = missionRun; + logger.LogInformation($"Updated last successful mission run on mission definition {missionDefinitionId} to mission run {missionRunId}"); + } return await Update(missionDefinition); }