Skip to content

Commit

Permalink
feat: publish found node
Browse files Browse the repository at this point in the history
  • Loading branch information
seilc1 committed Aug 24, 2024
1 parent 730947c commit 1dbb8f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/TrackMate.Backend.RestApi/Hubs/TrackNodeHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/Trackmate.Backend/Tracks/TrackService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TrackModel> StartTrackAsync(StartTrackModel startTrackModel)
{
Expand Down Expand Up @@ -48,11 +48,11 @@ public async Task<TrackUpdateResult> 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);
Expand Down

0 comments on commit 1dbb8f7

Please sign in to comment.