Skip to content

Commit 850b2f3

Browse files
committed
fix(fundings): Correct institutions graphs on Region view
1 parent 5c7789e commit 850b2f3

5 files changed

Lines changed: 25 additions & 5 deletions

File tree

client/src/boards/financements-par-aap/charts/french-partners/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,12 @@ export default function FrenchPartners({ name }: { name: string | undefined }) {
170170
},
171171
},
172172
},
173-
};
173+
}
174+
if (region) {
175+
const filters = body.query.bool.filter.filter((f) => !f?.terms?.["participant_region.keyword"])// && f?.terms?.["participant_region.keyword"]?.length === 0 && f?.terms?.["participant_region.keyword"]?.[0] === region)
176+
filters.push({ terms: { "participant_region_with_labs.keyword": [region] } })
177+
body.query.bool.filter = filters
178+
}
174179

175180
const { data, isLoading } = useQuery({
176181
queryKey: ["fundings-french-partners", region, structure, yearMax, yearMin],

client/src/boards/financements-par-aap/charts/institutions/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,12 @@ export default function Institutions({ name }: { name: string | undefined }) {
170170
},
171171
},
172172
},
173-
};
173+
}
174+
if (region) {
175+
const filters = body.query.bool.filter.filter((f) => !f?.terms?.["participant_region.keyword"])// && f?.terms?.["participant_region.keyword"]?.length === 0 && f?.terms?.["participant_region.keyword"]?.[0] === region)
176+
filters.push({ terms: { "participant_region_with_labs.keyword": [region] } })
177+
body.query.bool.filter = filters
178+
}
174179

175180
const { data, isLoading } = useQuery({
176181
queryKey: ["fundings-institutions", region, structure, yearMax, yearMin],

client/src/boards/financements-par-aap/charts/international-partners/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,12 @@ export default function InternationalPartners({ name }: { name: string | undefin
170170
},
171171
},
172172
},
173-
};
173+
}
174+
if (region) {
175+
const filters = body.query.bool.filter.filter((f) => !f?.terms?.["participant_region.keyword"])// && f?.terms?.["participant_region.keyword"]?.length === 0 && f?.terms?.["participant_region.keyword"]?.[0] === region)
176+
filters.push({ terms: { "participant_region_with_labs.keyword": [region] } })
177+
body.query.bool.filter = filters
178+
}
174179

175180
const { data, isLoading } = useQuery({
176181
queryKey: ["fundings-international-partners", region, structure, yearMax, yearMin],

client/src/boards/financements-par-aap/charts/laboratories/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,12 @@ export default function Laboratories({ name }: { name: string | undefined }) {
170170
},
171171
},
172172
},
173-
};
173+
}
174+
if (region) {
175+
const filters = body.query.bool.filter.filter((f) => !f?.terms?.["participant_region.keyword"])// && f?.terms?.["participant_region.keyword"]?.length === 0 && f?.terms?.["participant_region.keyword"]?.[0] === region)
176+
filters.push({ terms: { "participant_region_with_labs.keyword": [region] } })
177+
body.query.bool.filter = filters
178+
}
174179

175180
const { data, isLoading } = useQuery({
176181
queryKey: ["fundings-laboratories", region, structure, yearMax, yearMin],

client/src/boards/financements-par-aap/pages/region/displayRegion.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function DisplayRegion() {
3535
{ id: "apercu", label: "Aperçu" },
3636
{ id: "financements", label: "Volume et répartition des financements" },
3737
{ id: "evolution", label: "Evolution temporelle" },
38-
{ id: "partenaires", label: "Institutions partenaires" },
38+
// { id: "partenaires", label: "Institutions partenaires" },
3939
{ id: "institutions", label: "Institutions" },
4040
{ id: "laboratoires", label: "Laboratoires" },
4141
{ id: "disciplines", label: "Disciplines" },

0 commit comments

Comments
 (0)