Skip to content

Commit

Permalink
fix(taxonomy): add missing filter in TaxonSheetService
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize committed Feb 25, 2025
1 parent 722395e commit f23db17
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Injectable } from '@angular/core';
import { ConfigService } from '@geonature/services/config.service';
import { DataFormService } from '@geonature_common/form/data-form.service';
import { Taxon } from '@geonature_common/form/taxonomy/taxonomy.component';
import { BehaviorSubject } from 'rxjs';
Expand All @@ -7,7 +8,10 @@ import { BehaviorSubject } from 'rxjs';
export class TaxonSheetService {
taxon: BehaviorSubject<Taxon | null> = new BehaviorSubject<Taxon | null>(null);

constructor(private _ds: DataFormService) {}
constructor(
private _ds: DataFormService,
public config: ConfigService
) {}

updateTaxonByCdRef(cd_ref: number) {
const taxon = this.taxon.getValue();
Expand All @@ -16,6 +20,9 @@ export class TaxonSheetService {
}
const taxhubFields = ['attributs', 'attributs.bib_attribut.label_attribut', 'status'];
this._ds.getTaxonInfo(cd_ref, taxhubFields).subscribe((taxon) => {
taxon['attributs'] = taxon['attributs'].filter((v) => {
return this.config.SYNTHESE.ID_ATTRIBUT_TAXHUB.includes(v.id_attribut);
});
this.taxon.next(taxon);
});
}
Expand Down

0 comments on commit f23db17

Please sign in to comment.