Skip to content

Commit

Permalink
fix: size on filters
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNumericite committed Feb 2, 2024
1 parent f2fb2b6 commit 46726d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
3 changes: 1 addition & 2 deletions webapp-next/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ export function useDepartments(departments: string[]) {
index: 'cm2d_departments',
filters: JSON.stringify({
terms: {
department: departments,
size: 100
department: departments
}
})
};
Expand Down
21 changes: 7 additions & 14 deletions webapp-next/utils/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,12 @@ export function transformFilters(filters: Filters): any[] {
should: [
{
terms: {
categories_level_1: filters.categories,
size: 100
categories_level_1: filters.categories
}
},
{
terms: {
categories_level_2: filters.categories,
size: 100
categories_level_2: filters.categories
}
}
],
Expand All @@ -287,16 +285,14 @@ export function transformFilters(filters: Filters): any[] {
case 'category_1':
transformed.push({
terms: {
categories_level_1: filters.categories,
size: 100
categories_level_1: filters.categories
}
});
break;
case 'category_2':
transformed.push({
terms: {
categories_level_2: filters.categories,
size: 100
categories_level_2: filters.categories
}
});
break;
Expand Down Expand Up @@ -339,17 +335,15 @@ export function transformFilters(filters: Filters): any[] {
if (filters.sex.length > 0) {
transformed.push({
terms: {
sex: filters.sex,
size: 100
sex: filters.sex
}
});
}

if (filters.death_location.length > 0) {
transformed.push({
terms: {
death_location: filters.death_location,
size: 100
death_location: filters.death_location
}
});
}
Expand All @@ -359,8 +353,7 @@ export function transformFilters(filters: Filters): any[] {
home_department:
filters.department.length > 0
? filters.department
: filters.region_departments,
size: 100
: filters.region_departments
}
});

Expand Down

0 comments on commit 46726d4

Please sign in to comment.