Skip to content

Commit

Permalink
1-3128: handle some form of nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman committed Nov 18, 2024
1 parent 8fdb359 commit a8bd8d2
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions src/lib/features/feature-search/feature-search-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,40 @@ export class FeatureSearchService {
if (params.state) {
const parsedState = parseSearchOperatorValue('stale', params.state);
if (parsedState) {
parsedState.values = parsedState.values.map((value) =>
value === 'active' ? 'false' : 'true',
const potentiallyStale = parsedState.values.some((value) =>
value?.includes('potentiallyStale'),
);
queryParams.push(parsedState);
if (potentiallyStale) {
if (
parsedState.operator === 'IS' ||
parsedState.operator === 'IS_ANY_OF'
) {
queryParams.push({
field: 'features.potentially_stale',
operator: 'IS',
values: ['true'],
});
} else {
queryParams.push({
field: 'features.potentially_stale',
operator: 'IS_ANY_OF',
values: [null, 'false'],
});
}
}
const otherValues = parsedState.values.filter(
(value) => !value?.includes('potentiallyStale'),
);

if (otherValues.length) {
queryParams.push({
field: 'stale',
operator: parsedState.operator,
values: otherValues.map((value) =>
value === 'active' ? 'false' : 'true',
),
});
}
}
}

Expand Down

0 comments on commit a8bd8d2

Please sign in to comment.