From b84ae6ff5876ca2584225753d064c6d0be307b44 Mon Sep 17 00:00:00 2001 From: Eddasol Date: Tue, 23 Jan 2024 19:58:37 +0100 Subject: [PATCH] Include localisation and return mission as default --- .../Controllers/Models/MissionRunQueryStringParameters.cs | 8 ++++---- backend/api/Services/MissionRunService.cs | 6 ++++-- frontend/src/api/ApiCaller.tsx | 2 ++ frontend/src/models/MissionRunQueryParameters.ts | 2 ++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/backend/api/Controllers/Models/MissionRunQueryStringParameters.cs b/backend/api/Controllers/Models/MissionRunQueryStringParameters.cs index af7b7a65..2bc16581 100644 --- a/backend/api/Controllers/Models/MissionRunQueryStringParameters.cs +++ b/backend/api/Controllers/Models/MissionRunQueryStringParameters.cs @@ -61,14 +61,14 @@ public MissionRunQueryStringParameters() public List? InspectionTypes { get; set; } /// - /// Filter for whether the result should include localisation missions. The default is false + /// Filter for whether the result should exclude localisation missions. The default is false /// - public bool IncludeLocalisation { get; set; } + public bool ExcludeLocalisation { get; set; } /// - /// Filter for whether the result should include return to home missions. The default is false + /// Filter for whether the result should exclude return to home missions. The default is false /// - public bool IncludeReturnToHome { get; set; } + public bool ExcludeReturnToHome { get; set; } #region Time Filters diff --git a/backend/api/Services/MissionRunService.cs b/backend/api/Services/MissionRunService.cs index a4092779..e1692526 100644 --- a/backend/api/Services/MissionRunService.cs +++ b/backend/api/Services/MissionRunService.cs @@ -279,6 +279,8 @@ private static void SearchByTag(ref IQueryable missionRuns, string? /// , /// , /// , + /// , + /// , /// , /// , /// , @@ -331,11 +333,11 @@ MissionRunQueryStringParameters parameters ) ); - Expression> localisationFilter = parameters.IncludeLocalisation + Expression> localisationFilter = !parameters.ExcludeLocalisation ? missionRun => true : missionRun => !(missionRun.Tasks.Count() == 1 && missionRun.Tasks.All(task => task.Type == MissionTaskType.Localization)); - Expression> returnTohomeFilter = parameters.IncludeReturnToHome + Expression> returnTohomeFilter = !parameters.ExcludeReturnToHome ? missionRun => true : missionRun => !(missionRun.Tasks.Count() == 1 && missionRun.Tasks.All(task => task.Type == MissionTaskType.DriveTo)); diff --git a/frontend/src/api/ApiCaller.tsx b/frontend/src/api/ApiCaller.tsx index 0e0b29af..e372e4e4 100644 --- a/frontend/src/api/ApiCaller.tsx +++ b/frontend/src/api/ApiCaller.tsx @@ -177,6 +177,8 @@ export class BackendAPICaller { if (parameters.nameSearch) path = path + 'NameSearch=' + parameters.nameSearch + '&' if (parameters.robotNameSearch) path = path + 'RobotNameSearch=' + parameters.robotNameSearch + '&' if (parameters.tagSearch) path = path + 'TagSearch=' + parameters.tagSearch + '&' + if (parameters.excludeLocalisation) path = path + 'ExcludeLocalisation=' + parameters.excludeLocalisation + '&' + if (parameters.excludeReturnToHome) path = path + 'ExcludeReturnToHome=' + parameters.excludeReturnToHome + '&' if (parameters.minStartTime) path = path + 'MinStartTime=' + parameters.minStartTime + '&' if (parameters.maxStartTime) path = path + 'MaxStartTime=' + parameters.maxStartTime + '&' if (parameters.minEndTime) path = path + 'MinEndTime=' + parameters.minEndTime + '&' diff --git a/frontend/src/models/MissionRunQueryParameters.ts b/frontend/src/models/MissionRunQueryParameters.ts index d278d2da..131bbab7 100644 --- a/frontend/src/models/MissionRunQueryParameters.ts +++ b/frontend/src/models/MissionRunQueryParameters.ts @@ -10,6 +10,8 @@ export interface MissionRunQueryParameters { tagSearch?: string inspectionTypes?: InspectionType[] area?: string + excludeLocalisation?: boolean + excludeReturnToHome?: boolean minStartTime?: number maxStartTime?: number minEndTime?: number