From 1dbb8f71a6d75140fbfbc0ac1347f7a4455a3cbb Mon Sep 17 00:00:00 2001 From: christoph seiler Date: Sun, 25 Aug 2024 00:44:30 +0200 Subject: [PATCH] feat: publish found node --- src/TrackMate.Backend.RestApi/Hubs/TrackNodeHub.cs | 2 +- src/Trackmate.Backend/Tracks/TrackService.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TrackMate.Backend.RestApi/Hubs/TrackNodeHub.cs b/src/TrackMate.Backend.RestApi/Hubs/TrackNodeHub.cs index 0fe0644..a42f1e9 100644 --- a/src/TrackMate.Backend.RestApi/Hubs/TrackNodeHub.cs +++ b/src/TrackMate.Backend.RestApi/Hubs/TrackNodeHub.cs @@ -82,7 +82,7 @@ public async Task UploadTrackPositionPicture(UploadTrackPositionPicture uploadTr { logger.LogInformation("Uploaded picture for track position {trackId}.", uploadTrackPositionPicture.TrackId); - Task announce(bool success) => SendToTrackAsync(uploadTrackPositionPicture.TrackId, "TrackPositionPictureMatched", success); + Task announce(FoundTrackNodeModel? foundModel) => SendToTrackAsync(uploadTrackPositionPicture.TrackId, "TrackPositionPictureMatched", foundModel); TrackUpdateResult result = await trackService.UpdateTrackAsync(uploadTrackPositionPicture, announce, default); if (result.type == TrackUpdateResultType.NewInstruction) diff --git a/src/Trackmate.Backend/Tracks/TrackService.cs b/src/Trackmate.Backend/Tracks/TrackService.cs index 2c8edc7..604b481 100644 --- a/src/Trackmate.Backend/Tracks/TrackService.cs +++ b/src/Trackmate.Backend/Tracks/TrackService.cs @@ -16,7 +16,7 @@ public class TrackService( PictureEmbeddingClient pictureEmbeddingClient, InstructionsClient instructionsClient) { - public delegate Task AnnouncePictureDetectionResult(bool found); + public delegate Task AnnouncePictureDetectionResult(FoundTrackNodeModel? found); public async Task StartTrackAsync(StartTrackModel startTrackModel) { @@ -48,11 +48,11 @@ public async Task UpdateTrackAsync( if (foundTrackNodeModel == FoundTrackNodeModel.None) { - await announcePictureDetectionResult(false); + await announcePictureDetectionResult(null); logger.LogInformation("No track node found for embedding."); return TrackUpdateResult.NoLocation; } - await announcePictureDetectionResult(true); + await announcePictureDetectionResult(foundTrackNodeModel); TrackNodeModel currentTrackNode = await trackNodeDataSource.GetTrackNodeAsync(track.LastVisitedNode.TrackNode.Id, CancellationToken.None); TrackNodePath path = await trackNodeDataSource.FindPathAsync(foundTrackNodeModel.TrackNodeId, track.GoalNode.Id, CancellationToken.None);