Skip to content

Commit

Permalink
Include localisation and return mission as default
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddasol committed Jan 24, 2024
1 parent 6cbe8dc commit b84ae6f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public MissionRunQueryStringParameters()
public List<InspectionType>? InspectionTypes { get; set; }

/// <summary>
/// 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
/// </summary>
public bool IncludeLocalisation { get; set; }
public bool ExcludeLocalisation { get; set; }

/// <summary>
/// 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
/// </summary>
public bool IncludeReturnToHome { get; set; }
public bool ExcludeReturnToHome { get; set; }

#region Time Filters

Expand Down
6 changes: 4 additions & 2 deletions backend/api/Services/MissionRunService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ private static void SearchByTag(ref IQueryable<MissionRun> missionRuns, string?
/// <see cref="MissionRunQueryStringParameters.RobotNameSearch" />,
/// <see cref="MissionRunQueryStringParameters.TagSearch" />,
/// <see cref="MissionRunQueryStringParameters.InspectionTypes" />,
/// <see cref="MissionRunQueryStringParameters.ExcludeLocalisation" />,
/// <see cref="MissionRunQueryStringParameters.ExcludeReturnToHome" />,
/// <see cref="MissionRunQueryStringParameters.MinStartTime" />,
/// <see cref="MissionRunQueryStringParameters.MaxStartTime" />,
/// <see cref="MissionRunQueryStringParameters.MinEndTime" />,
Expand Down Expand Up @@ -331,11 +333,11 @@ MissionRunQueryStringParameters parameters
)
);

Expression<Func<MissionRun, bool>> localisationFilter = parameters.IncludeLocalisation
Expression<Func<MissionRun, bool>> localisationFilter = !parameters.ExcludeLocalisation
? missionRun => true
: missionRun => !(missionRun.Tasks.Count() == 1 && missionRun.Tasks.All(task => task.Type == MissionTaskType.Localization));

Expression<Func<MissionRun, bool>> returnTohomeFilter = parameters.IncludeReturnToHome
Expression<Func<MissionRun, bool>> returnTohomeFilter = !parameters.ExcludeReturnToHome
? missionRun => true
: missionRun => !(missionRun.Tasks.Count() == 1 && missionRun.Tasks.All(task => task.Type == MissionTaskType.DriveTo));

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/api/ApiCaller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 + '&'
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/models/MissionRunQueryParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export interface MissionRunQueryParameters {
tagSearch?: string
inspectionTypes?: InspectionType[]
area?: string
excludeLocalisation?: boolean
excludeReturnToHome?: boolean
minStartTime?: number
maxStartTime?: number
minEndTime?: number
Expand Down

0 comments on commit b84ae6f

Please sign in to comment.