Conditionally (defaults to true) add install counts to app list view. #454
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR returns the "install count" column to the Application Inventory list view. It adds the ability to decide not to show it based on a setting (which you add to the database, typically via the admin panel).
Also, this changes the method by which install counts are calculated. We
used to annotate the entire queryset. This unfortunately would get run
more than once, so performance impact was compounded.
Now, we instead use the
.count
method for each row, which then onlygets run for the rows displayed (page length defaults to 20 I think).
In my testing, these individual counts are very fast, so the addition of
install counts is a minor part of the total query time.
Long term, if this solves the performance issues for even large
deployments, we could just remove the dynamic determination of whether
to include the column or not.