-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
fix: list projects with all archived toggles #3020
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix, it feels so obvious why mine did not work when the solution is in front of me.
.orderBy('projects.name', 'asc'); | ||
if (query) { | ||
projects = projects.where(query); | ||
} | ||
let selectColumns = [ | ||
this.db.raw( | ||
'projects.id, projects.name, projects.description, projects.health, projects.updated_at, count(features.name) AS number_of_features', | ||
'projects.id, projects.name, projects.description, projects.health, projects.updated_at, count(features.name) FILTER (WHERE features.archived_at is null) AS number_of_features', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs about filter on aggregate functions: https://www.postgresql.org/docs/current/sql-expressions.html
While trying to count only features that are not archived to display the amount of features of a project, accidentally we filtered out projects with all features archived (they should show up in the list but with count of features zero)
About the changes
While trying to count only features that are not archived to display the amount of features of a project, accidentally we filtered out projects with all features archived (they should show up in the list but with count of features zero)
Improves: #2923