Skip to content

Commit

Permalink
Update inspections after isar mission accepted
Browse files Browse the repository at this point in the history
  • Loading branch information
mrica-equinor committed Jan 23, 2025
1 parent fe8103a commit c10b529
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion backend/api/Services/MissionRunService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,27 @@ public async Task Update(MissionRun missionRun)
DetachTracking(context, missionRun!);
}

public async Task UpdateWithInspections(MissionRun missionRun)
{
if (missionRun.Robot is not null)
{
context.Entry(missionRun.Robot).State = EntityState.Unchanged;
}
if (missionRun.InspectionArea is not null)
{
context.Entry(missionRun.InspectionArea).State = EntityState.Unchanged;
}

var entry = context.Update(missionRun);
await ApplyDatabaseUpdate(missionRun.InspectionArea?.Installation);
_ = signalRService.SendMessageAsync(
"Mission run updated",
missionRun?.InspectionArea?.Installation,
missionRun != null ? new MissionRunResponse(missionRun) : null
);
DetachTracking(context, missionRun!);
}

public async Task<MissionRun?> Delete(string id)
{
var missionRun = await GetMissionRunsWithSubModels()
Expand Down Expand Up @@ -813,7 +834,7 @@ await ReadById(missionRunId, readOnly: true)
var task = missionRun.GetTaskByIsarId(isarTask.IsarTaskId);
task?.UpdateWithIsarInfo(isarTask);
}
await Update(missionRun);
await UpdateWithInspections(missionRun);
return missionRun;
}
}
Expand Down

0 comments on commit c10b529

Please sign in to comment.