Skip to content

Commit

Permalink
Add iconic_taxon_name to observations.taxonomy response (#414)
Browse files Browse the repository at this point in the history
Include iconic_taxon_name in observations.taxonomy response
  • Loading branch information
kueda authored Nov 3, 2023
1 parent 3edfb9b commit 444364f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/models/taxon.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,10 @@ const Taxon = class Taxon extends Model {
const taxonIDs = _.map( taxa, "id" );
if ( _.isEmpty( taxonIDs ) ) { return; }
const query = squel.select( )
.field( "id, name, rank, rank_level, ancestry, is_active" )
.field( "taxa.id, taxa.name, taxa.rank, taxa.rank_level, taxa.ancestry, taxa.is_active, iconic_taxa.name AS iconic_taxon_name" )
.from( "taxa" )
.where( "id IN ?", util.paramArray( taxonIDs ) );
.join( "taxa iconic_taxa", null, "taxa.iconic_taxon_id = iconic_taxa.id" )
.where( "taxa.id IN ?", util.paramArray( taxonIDs ) );
const result = await pgClient.query( query.toString( ) );
const taxonDetails = { };
_.each( result.rows, row => {
Expand Down

0 comments on commit 444364f

Please sign in to comment.