From 5637b8b098a3978a2f733ec5f6c1c1ab590d7c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Fri, 2 Feb 2024 16:38:31 +0100 Subject: [PATCH] fix: switch department elk variable to home_department --- webapp-next/components/charts/doughnut/Header.tsx | 4 ++-- webapp-next/components/charts/histogram/Header.tsx | 4 ++-- webapp-next/components/charts/line/Header.tsx | 8 +++++--- webapp-next/components/charts/map/Header.tsx | 2 +- webapp-next/components/charts/table/Header.tsx | 4 ++-- webapp-next/utils/tools.ts | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/webapp-next/components/charts/doughnut/Header.tsx b/webapp-next/components/charts/doughnut/Header.tsx index 4b13117..409fc27 100644 --- a/webapp-next/components/charts/doughnut/Header.tsx +++ b/webapp-next/components/charts/doughnut/Header.tsx @@ -23,7 +23,7 @@ type Field = | 'sex' | 'age' | 'death_location' - | 'department' + | 'home_department' | 'years' | 'categories_level_1' | 'categories_level_2'; @@ -48,7 +48,7 @@ export function ChartDoughnutHeader() { { label: 'Sexe', value: 'sex' }, { label: 'Age', value: 'age' }, { label: 'Lieu de décès', value: 'death_location' }, - { label: 'Département', value: 'department' }, + { label: 'Département', value: 'home_department' }, { label: 'Année', value: 'years' } ]; diff --git a/webapp-next/components/charts/histogram/Header.tsx b/webapp-next/components/charts/histogram/Header.tsx index a88520b..a7e0c6d 100644 --- a/webapp-next/components/charts/histogram/Header.tsx +++ b/webapp-next/components/charts/histogram/Header.tsx @@ -23,7 +23,7 @@ type Field = | 'sex' | 'age' | 'death_location' - | 'department' + | 'home_department' | 'years' | 'categories_level_1' | 'categories_level_2'; @@ -48,7 +48,7 @@ export function ChartHistogramHeader() { { label: 'Sexe', value: 'sex' }, { label: 'Age', value: 'age' }, { label: 'Lieu de décès', value: 'death_location' }, - { label: 'Département', value: 'department' }, + { label: 'Département', value: 'home_department' }, { label: 'Année', value: 'years' } ]; diff --git a/webapp-next/components/charts/line/Header.tsx b/webapp-next/components/charts/line/Header.tsx index 80d61c6..a72027e 100644 --- a/webapp-next/components/charts/line/Header.tsx +++ b/webapp-next/components/charts/line/Header.tsx @@ -18,7 +18,7 @@ type Field = | 'sex' | 'age' | 'death_location' - | 'department' + | 'home_department' | 'years' | 'categories_level_1' | 'categories_level_2'; @@ -43,7 +43,7 @@ export function ChartLineHeader() { { label: 'Sexe', value: 'sex' }, { label: 'Age', value: 'age' }, { label: 'Lieu de décès', value: 'death_location' }, - { label: 'Département', value: 'department' }, + { label: 'Département', value: 'home_department' }, { label: 'Année', value: 'years' } ]; @@ -65,7 +65,9 @@ export function ChartLineHeader() { if (isAggregated) { aggregation = baseAggregation; } else { - if (['sex', 'death_location', 'department'].includes(aggregateField)) { + if ( + ['sex', 'death_location', 'home_department'].includes(aggregateField) + ) { aggregation = { aggregated_parent: { terms: { diff --git a/webapp-next/components/charts/map/Header.tsx b/webapp-next/components/charts/map/Header.tsx index 33a2dbc..29c5dea 100644 --- a/webapp-next/components/charts/map/Header.tsx +++ b/webapp-next/components/charts/map/Header.tsx @@ -76,7 +76,7 @@ export function ChartMapHeader() { const xAgg: any = { aggregated_x: { terms: { - field: 'department' + field: 'home_department' } } }; diff --git a/webapp-next/components/charts/table/Header.tsx b/webapp-next/components/charts/table/Header.tsx index 0e37e2c..63d7a54 100644 --- a/webapp-next/components/charts/table/Header.tsx +++ b/webapp-next/components/charts/table/Header.tsx @@ -23,7 +23,7 @@ type Field = | 'sex' | 'age' | 'death_location' - | 'department' + | 'home_department' | 'months' | 'categories_level_1' | 'categories_level_2'; @@ -50,7 +50,7 @@ export function ChartTableHeader() { { label: 'Sexe', value: 'sex' }, { label: 'Age', value: 'age' }, { label: 'Lieu de décès', value: 'death_location' }, - { label: 'Département', value: 'department' }, + { label: 'Département', value: 'home_department' }, { label: 'Mois', value: 'months' } ]; diff --git a/webapp-next/utils/tools.ts b/webapp-next/utils/tools.ts index 762813e..daff4c8 100644 --- a/webapp-next/utils/tools.ts +++ b/webapp-next/utils/tools.ts @@ -350,7 +350,7 @@ export function transformFilters(filters: Filters): any[] { transformed.push({ terms: { - department: + home_department: filters.department.length > 0 ? filters.department : filters.region_departments