hyrax icon indicating copy to clipboard operation
hyrax copied to clipboard

Dashboard Statistics generates NoMethodError (nurax-pg)

Open eporter23 opened this issue 2 years ago • 4 comments

Descriptive summary

Hyrax 3.3 for nurax-pg: when logged as in administrator, trying to view the Statistics (reports) section of the dashboard returns an error.

Rationale

For maintaining current Hyrax functionality, admin users should be able to access the Statistics section of the dashboard.

Expected behavior

Admin user can see summary statistics and date range selection options

Actual behavior

NoMethodError page is shown

Steps to reproduce the behavior

  1. Login as an admin-level user
  2. Go to the Dashboard and look at the Activity section
  3. Click on Statistics in the left column
  4. See error page
Screen Shot 2022-03-31 at 1 23 30 PM Screen Shot 2022-03-31 at 1 24 13 PM

Equivalent page in nurax-dev: Screen Shot 2022-03-31 at 1 25 49 PM

eporter23 avatar Mar 31 '22 17:03 eporter23

Remaining work on #3820 - Replace calls to ActiveFedora::Base.where (removes 7 refs to ActiveFedora) might be needed for this issue

jlhardes avatar Aug 18 '22 21:08 jlhardes

The errors described in this ticket seems to ultimately trace back to Hyrax::AbstractTypeRelation. This class explicitly inherits from ActiveFedora::Relation.

The purpose of the Hyrax::AbstractTypeRelation class, as far as I can tell, is primarily scoping Solr queries. The only thing I'm not sure about is DummyModel.delegated_attributes; I'm not sure what that's used for, but either way it seems very ActiveFedora-specific.

I think this whole file could be refactored to use Valkyrie query services.

An observation I had was that a lot of code that uses AbstractTypeRelation and its subclasses hasn't been touched in several years, so there might be a case for just removing this logic if it isn't needed anymore. I don't personally have enough context to say definitively though.

Any guidance on how to move forward is appreciated.

bkiahstroud avatar Jun 01 '23 20:06 bkiahstroud

I agree, it could be refactored to use valkyrie. The WorkRelation subclass is used in a variety of places in Hyrax, so not something that can be retired. Creating a full valkyrie refactor that includes all of the features of AF::Relation is probably not needed if we can identify which methods are actually used. That seems to be #search_in_batches, #find, #search_with_conditions, #find_each, #where ?

WorkQueryService uses WorkRelation and has WorkResourceQueryService as a valkyrie replacement. Perhaps the other uses can be substituted similarly? Another thought is can some valkyrie custom queries be the replacement?

I think delegated_attributes is a list of methods that can be set by the model that should be listed and accessible in the same way as standard model attributes.

dlpierce avatar Jun 02 '23 21:06 dlpierce

This ticket is on hold until the GA4 work is complete, as it is currently not working in hyrax main.

crisr15 avatar Jul 21 '23 20:07 crisr15

Viewing Statistics as an admin from the Dashboard is working in Hyrax 5.0.0 on both https://dev.nurax.samvera.org/ and https://pg.nurax.samvera.org/. There are no errors and date range filters work as well.

jlhardes avatar Mar 19 '24 14:03 jlhardes