Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { FilterConfigType } from '@/shared/modules/filters/types/FilterConfig';
import {
SelectFilterConfig, SelectFilterOptions,
SelectFilterValue,
} from '@/shared/modules/filters/types/filterTypes/SelectFilterConfig';
MultiSelectFilterConfig, MultiSelectFilterOptions,
MultiSelectFilterValue,
} from '@/shared/modules/filters/types/filterTypes/MultiSelectFilterConfig';
import { itemLabelRendererByType } from '@/shared/modules/filters/config/itemLabelRendererByType';
import options from './options';

const headcount: SelectFilterConfig = {
const headcount: MultiSelectFilterConfig = {
id: 'headcount',
label: 'Headcount',
iconClass: 'ri-group-2-line',
type: FilterConfigType.SELECT,
type: FilterConfigType.MULTISELECT,
options: {
options,
},
itemLabelRenderer(value: SelectFilterValue, options: SelectFilterOptions): string {
return itemLabelRendererByType[FilterConfigType.SELECT]('Headcount', value, options);
itemLabelRenderer(value: MultiSelectFilterValue, options: MultiSelectFilterOptions): string {
return itemLabelRendererByType[FilterConfigType.MULTISELECT]('Headcount', value, options);
},
apiFilterRenderer({ value, include }: SelectFilterValue): any[] {
apiFilterRenderer({ value, include }: MultiSelectFilterValue): any[] {
const filter = {
size: { eq: value },
or: value.map((count) => ({ size: count })),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it needs to be:

or: value.map((count) => ({ size: { eq: count } })),

Otherwise API returns 500

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

};
return [
(include ? filter : { not: filter }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const options: MultiSelectFilterOptionGroup[] = [
label: '501-1000',
value: '501-1000',
},
{
label: '> 1000',
value: '1000+',
},
Comment on lines +26 to +37
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue scoping was not completely ok.
This specific attribute is following the canonical values from https://docs.peopledatalabs.com/docs/company-sizes

Instead of this new selection item, can you add support for
1001-5000
5001-10000
10001+

instead?

Apologies for the confusion

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

],
},
];
Expand Down