Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iconic_taxon_name to observations.taxonomy response #414

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Inlucde iconic_taxon_name in observations.taxonomy response
kueda committed Nov 2, 2023
commit 88677e0dbb508be5f20fc14b139d543ad8fa586f
5 changes: 3 additions & 2 deletions lib/models/taxon.js
Original file line number Diff line number Diff line change
@@ -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 => {