Skip to content

Commit

Permalink
nom_vern ou lb_nom cf #18
Browse files Browse the repository at this point in the history
  • Loading branch information
joelclems committed Jun 8, 2020
1 parent a358f5a commit abba4a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion frontend/app/services/data-utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/services/monitoring-object.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class MonitoringObjectService {
fieldName: "label_fr",
},
taxonomy: {
fieldName: "nom_vern",
fieldName: "nom_vern,lb_nom",
},
};

Expand Down

0 comments on commit abba4a8

Please sign in to comment.