Skip to content

Commit

Permalink
Moved raw order for author filtering to correct place (#10166) (#10171)
Browse files Browse the repository at this point in the history
refs #10105

- ordering !== filtering
  • Loading branch information
kirrg001 authored and daniellockyer committed Jun 15, 2021
1 parent abb7d5e commit 3fd15d1
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions packages/bookshelf-filter/lib/bookshelf-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,6 @@ filter = function filter(Bookshelf) {
.query('leftOuterJoin', 'posts_authors', 'posts_authors.post_id', '=', 'posts.id')
.query('leftOuterJoin', 'users as authors', 'posts_authors.author_id', '=', 'authors.id');

// The order override should ONLY happen if we are doing an "IN" query
// TODO move the order handling to the query building that is currently inside pagination
// TODO make the order handling in pagination handle orderByRaw
// TODO extend this handling to all joins
if (gql.json.findStatement(this._filters.statements, {prop: /^authors/, op: 'IN'})) {
// TODO make this count the number of MATCHING authors, not just the number of authors
this.query('orderByRaw', 'count(authors.id) DESC');
}

// We need to add a group by to counter the double left outer join
// TODO improve on the group by handling
options.groups = options.groups || [];
Expand Down

0 comments on commit 3fd15d1

Please sign in to comment.