Skip to content

Commit

Permalink
do not get all collections for dashboard (#5325)
Browse files Browse the repository at this point in the history
`@collections` cannot be set with `Collection.order` when `Collection` is `Hyrax::PcdmCollection`.  The `order` method is not defined.  Use of `all` was suggested, but it is also not defined for `Hyrax::PcdmCollection`.

There is an alternative approach to get all collections, but it is not clear that this is necessary.
* `@collections` does not appear to be used anywhere (added in PR #5089) which was the PR that added the new Analytics
* `@collections` does not appear to have been used prior to this PR in any `views` or `presenters`
* getting all collections is very expensive and should be avoided unless really necessary
* if collections are required, it is better to get them from solr instead of the persistent store.  This will also enforce permissions if search builders are used.

For all these reasons, setting `@collections` is being removed.
  • Loading branch information
elrayle committed Jan 19, 2022
1 parent 03201a5 commit 740840a
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion app/controllers/hyrax/dashboard_controller.rb
Expand Up @@ -21,7 +21,6 @@ def show
if can? :read, :admin_dashboard
@presenter = Hyrax::Admin::DashboardPresenter.new
@admin_set_rows = Hyrax::AdminSetService.new(self).search_results_with_work_count(:read)
@collections = Collection.order(date_modified: :desc)
render 'show_admin'
else
@presenter = Dashboard::UserPresenter.new(current_user, view_context, params[:since])
Expand Down

0 comments on commit 740840a

Please sign in to comment.