Skip to content
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

File analytics page throwing an error #5955

Closed
bbpennel opened this issue Feb 7, 2023 · 2 comments · Fixed by #5958
Closed

File analytics page throwing an error #5955

bbpennel opened this issue Feb 7, 2023 · 2 comments · Fixed by #5958

Comments

@bbpennel
Copy link
Contributor

bbpennel commented Feb 7, 2023

Descriptive summary

The "Analytics" page for FileSet objects is throwing an error in 3.x and 4.0. It can be viewed in nurax here:
https://nurax-dev.curationexperts.com/files/mg74qm227/stats?locale=en

undefined method `hyrax__analytics__google__pageviews' for #<Legato::Management::Profile:0x000055a7a115fa60>
Did you mean?  hyrax__analytics__google__events
               hyrax__analytics__google__visits

hyrax (79e9620f6a0c) app/models/hyrax/statistic.rb:37:in `ga_statistics'
hyrax (79e9620f6a0c) app/models/hyrax/statistic.rb:83:in `combined_stats'
hyrax (79e9620f6a0c) app/models/hyrax/statistic.rb:25:in `statistics'
hyrax (79e9620f6a0c) app/presenters/hyrax/file_usage.rb:36:in `pageviews'
hyrax (79e9620f6a0c) app/presenters/hyrax/file_usage.rb:24:in `to_flot'
hyrax (79e9620f6a0c) app/views/hyrax/stats/file.html.erb:5 
...

And I get a similar error in my local 3.5.0 repository, which is using google analytics for stats.

Its also worth noting that if you provide a ID that doesn't exist for an analytics link (works or filesets), there is an uncaught error thrown
https://nurax-dev.curationexperts.com/files/mg74qnope/stats?locale=en
https://nurax-dev.curationexperts.com/works/db78tnope/stats?locale=en

Expected behavior

File analytics pages loads.

Actual behavior

It throws an error.

Steps to reproduce the behavior

https://nurax-dev.curationexperts.com/files/mg74qm227/stats?locale=en
Or visit the Analytics link from a FileSet page in a hyrax 3+ instance.

@bbpennel
Copy link
Contributor Author

bbpennel commented Feb 7, 2023

It seems like the correct method may now be profile.hyrax__pageview and profile.hyrax__download. Overriding the statistic classes locally to use those appears to resolve the error for the file analytics page.

Edit: Or maybe not, it looks like hyrax 3.3 intentionally changed over to using the hyrax__analytics__google__ methods when they were previously using profile.hyrax__pageview
https://github.com/samvera/hyrax/pull/5089/files#diff-5b2a56b95bdff9c7fa8cc57e7444e3b10f7dc22f45aa739805e49cb19ae93d0fL15
which it seems like would only impact FileSets since work stats are now coming the Analytics and EventsDaily classes, rather than the statistic classes. So I'm feeling a bit confused.

@bbpennel
Copy link
Contributor Author

bbpennel commented Feb 8, 2023

@orangewolf @alishaevn @sara-g @no-reply and others that were involved with the analytics updates, I was wondering if you'd be able to advise on whether changing file_download_stat.rb and statistic.rb back to using profile.hyrax__pageview and profile.hyrax__download would be a good idea or not? It does appear to resolve the error in my local repository. There are so many commits on that PR that I'm not sure what change it was a part of, or the reason for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant