Skip to content

Commit

Permalink
fix: correctly apply distinct and resolve ambiguous column (usdigital…
Browse files Browse the repository at this point in the history
  • Loading branch information
as1729 authored and replicantSocks committed Sep 1, 2023
1 parent 4aae40e commit 2f23b00
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/server/src/db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,8 @@ async function getGrantsNew(filters, paginationParams, orderingParams, tenantId,
.modify((qb) => grantsQuery(qb, filters, agencyId, orderingParams, paginationParams));

const counts = await knex(TABLES.grants)
.distinct()
.modify((qb) => grantsQuery(qb, filters, agencyId, { orderBy: undefined }, null))
.count('grant_id as total_grants');
.countDistinct('grants.grant_id as total_grants');

const pagination = {
total: counts[0].total_grants,
Expand Down

0 comments on commit 2f23b00

Please sign in to comment.