@@ -75,7 +75,7 @@ export default function Classifications({ name }: { name: string | undefined })
7575 field : "participation_is_coordinator" ,
7676 } ,
7777 aggregations : {
78- should_ignore : {
78+ should_ignore_budget : {
7979 terms : {
8080 field : structure ? "participant_ignore_total_budget" : "region_ignore_total_budget" ,
8181 missing : false ,
@@ -116,9 +116,17 @@ export default function Classifications({ name }: { name: string | undefined })
116116 field : "participation_is_coordinator" ,
117117 } ,
118118 aggregations : {
119- sum_budget_participation : {
120- sum : {
121- field : "participation_funding" ,
119+ should_ignore_funding : {
120+ terms : {
121+ field : structure ? "participant_ignore_funding" : "region_ignore_funding" ,
122+ missing : false ,
123+ } ,
124+ aggregations : {
125+ sum_budget_participation : {
126+ sum : {
127+ field : "participation_funding" ,
128+ } ,
129+ } ,
122130 } ,
123131 } ,
124132 } ,
@@ -144,39 +152,41 @@ export default function Classifications({ name }: { name: string | undefined })
144152 } ) ;
145153
146154 const seriesBudget : any = [ ] ;
147- const seriesParticipation : any = [ ] ;
155+ const seriesFunding : any = [ ] ;
148156 const seriesProject : any = [ ] ;
149157 const classificationsBudget = data ?. aggregations ?. by_classifications_budget ?. buckets ?? [ ] ;
150- const classificationsParticipation = data ?. aggregations ?. by_classifications_participation ?. buckets ?? [ ] ;
158+ const classificationsFunding = data ?. aggregations ?. by_classifications_participation ?. buckets ?? [ ] ;
151159 const classificationsProject = data ?. aggregations ?. by_classifications_project ?. buckets ?? [ ] ;
152160 funders . forEach ( ( funder ) => {
153161 seriesBudget . push ( {
154162 color : { pattern : { ...pattern , backgroundColor : getCssColor ( { name : funder , prefix : "funder" } ) } } ,
155163 data : classificationsBudget . map ( ( classification ) => classification . by_project_type . buckets
156164 ?. find ( ( project ) => project . key === funder ) ?. is_coordinator ?. buckets
157- ?. find ( ( bucket ) => bucket . key === 1 ) ?. should_ignore ?. buckets
165+ ?. find ( ( bucket ) => bucket . key === 1 ) ?. should_ignore_budget ?. buckets
158166 ?. find ( ( bucket ) => bucket . key === 0 ) ?. sum_budget ?. value ?? 0 ) ,
159167 name : [ funder , getI18nLabel ( i18n , 'coordinator' ) ] . join ( ' - ' ) ,
160168 } ) ;
161169 seriesBudget . push ( {
162170 color : getCssColor ( { name : funder , prefix : "funder" } ) ,
163171 data : classificationsBudget . map ( ( classification ) => classification . by_project_type . buckets
164172 ?. find ( ( project ) => project . key === funder ) ?. is_coordinator ?. buckets
165- ?. find ( ( bucket ) => bucket . key === 0 ) ?. should_ignore ?. buckets
173+ ?. find ( ( bucket ) => bucket . key === 0 ) ?. should_ignore_budget ?. buckets
166174 ?. find ( ( bucket ) => bucket . key === 0 ) ?. sum_budget ?. value ?? 0 ) ,
167175 name : [ funder , getI18nLabel ( i18n , 'not-coordinator' ) ] . join ( ' - ' ) ,
168176 } ) ;
169- seriesParticipation . push ( {
177+ seriesFunding . push ( {
170178 color : { pattern : { ...pattern , backgroundColor : getCssColor ( { name : funder , prefix : "funder" } ) } } ,
171- data : classificationsParticipation . map ( ( classification ) => classification . by_project_type . buckets
179+ data : classificationsFunding . map ( ( classification ) => classification . by_project_type . buckets
172180 ?. find ( ( project ) => project . key === funder ) ?. is_coordinator ?. buckets
173- ?. find ( ( bucket ) => bucket . key === 1 ) ?. sum_budget_participation ?. value ?? 0 ) ,
181+ ?. find ( ( bucket ) => bucket . key === 1 ) ?. should_ignore_funding ?. buckets
182+ ?. find ( ( bucket ) => bucket . key === 0 ) ?. sum_budget_participation ?. value ?? 0 ) ,
174183 name : [ funder , getI18nLabel ( i18n , 'coordinator' ) ] . join ( ' - ' ) ,
175184 } ) ;
176- seriesParticipation . push ( {
185+ seriesFunding . push ( {
177186 color : getCssColor ( { name : funder , prefix : "funder" } ) ,
178- data : classificationsParticipation . map ( ( classification ) => classification . by_project_type . buckets
187+ data : classificationsFunding . map ( ( classification ) => classification . by_project_type . buckets
179188 ?. find ( ( project ) => project . key === funder ) ?. is_coordinator ?. buckets
189+ ?. find ( ( bucket ) => bucket . key === 0 ) ?. should_ignore_funding ?. buckets
180190 ?. find ( ( bucket ) => bucket . key === 0 ) ?. sum_budget_participation ?. value ?? 0 ) ,
181191 name : [ funder , getI18nLabel ( i18n , 'not-coordinator' ) ] . join ( ' - ' ) ,
182192 } ) ;
@@ -197,7 +207,7 @@ export default function Classifications({ name }: { name: string | undefined })
197207 } ) ;
198208 const categoriesProject = classificationsProject . map ( ( classification ) => classification . key ) ;
199209 const categoriesBudget = classificationsBudget . map ( ( classification ) => classification . key ) ;
200- const categoriesParticipation = classificationsParticipation . map ( ( classification ) => classification . key ) ;
210+ const categoriesFunding = classificationsFunding . map ( ( classification ) => classification . key ) ;
201211
202212 const title = `Financements par discipline de ${ structure ? "l'établissement" : "la région" } ${ name } ${ getYearRangeLabel ( { yearMax, yearMin } ) } ` ;
203213 // If view by number of projects
@@ -232,11 +242,11 @@ export default function Classifications({ name }: { name: string | undefined })
232242 // If view by amount by structure
233243 case 'amount_by_structure' :
234244 axis = getI18nLabel ( i18n , structure ? 'funding_by_structure' : 'funding_by_region' ) ;
235- categories = categoriesParticipation ;
245+ categories = categoriesFunding ;
236246 dataLabel = function ( this : any ) {
237247 return `${ formatCompactNumber ( this . y ) } €` ;
238248 } ;
239- series = seriesParticipation . reverse ( ) ;
249+ series = seriesFunding . reverse ( ) ;
240250 stackLabel = function ( this : any ) {
241251 return `${ formatCompactNumber ( this . total ) } €` ;
242252 } ;
0 commit comments