From abba4a80901dd4d44fa301c97ea1fa89bec5a20a Mon Sep 17 00:00:00 2001 From: "joel.clement" Date: Mon, 8 Jun 2020 12:27:07 +0200 Subject: [PATCH] nom_vern ou lb_nom cf #18 --- frontend/app/services/data-utils.service.ts | 15 ++++++++++++++- .../app/services/monitoring-object.service.ts | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/app/services/data-utils.service.ts b/frontend/app/services/data-utils.service.ts index e630cc786..e7e499584 100644 --- a/frontend/app/services/data-utils.service.ts +++ b/frontend/app/services/data-utils.service.ts @@ -47,7 +47,20 @@ export class DataUtilsService { .pipe( mergeMap( value => { - const out = fieldName === 'all' ? value : value[fieldName]; + let out = ''; + if ( fieldName === 'all') { + out = value; + } else if (fieldName.split(',').length >= 2) { + // plusieurs champs par ex 'nom_vern,lb_nom' si nom_vern null alors lb_nom + for (const fieldNameInter of fieldName.split(',')) { + if (value[fieldNameInter]) { + out = value[fieldNameInter]; + break; + } + } + } else { + out = value[fieldName]; + } return of(out); }) ); diff --git a/frontend/app/services/monitoring-object.service.ts b/frontend/app/services/monitoring-object.service.ts index 8273ca035..61b3b4fb8 100644 --- a/frontend/app/services/monitoring-object.service.ts +++ b/frontend/app/services/monitoring-object.service.ts @@ -26,7 +26,7 @@ export class MonitoringObjectService { fieldName: "label_fr", }, taxonomy: { - fieldName: "nom_vern", + fieldName: "nom_vern,lb_nom", }, };