hyrax
hyrax copied to clipboard
Dashboard Statistics generates NoMethodError (nurax-pg)
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
- Login as an admin-level user
- Go to the Dashboard and look at the Activity section
- Click on Statistics in the left column
- See error page


Equivalent page in nurax-dev:
Remaining work on #3820 - Replace calls to ActiveFedora::Base.where (removes 7 refs to ActiveFedora) might be needed for this issue
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.
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.
This ticket is on hold until the GA4 work is complete, as it is currently not working in hyrax main.
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.