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

Ensuring Hyrax::UserStatImporter returns false on exception #5875

Merged
merged 1 commit into from
Sep 30, 2022

Conversation

jeremyf
Copy link
Contributor

@jeremyf jeremyf commented Sep 20, 2022

Backport of #5874

Prior to this commit, in the retriable block, if we hit an exception, we'd return true and upstream we'd raise an exception.

In the below code, the extract_stats_for is returning true, because calls to Rails.logger.info return true.

view_stats = extract_stats_for(object: file, from: FileViewStat, start_date: start_date, user: user)
stats = tally_results(view_stats, :views, stats) if view_stats.present?

This resulted in attempting to call .each on the view_stats; which was true.

This builds on a [reported issue in Slack][1].

@samvera/hyrax-code-reviewers

Prior to this commit, in the retriable block, if we hit an exception,
we'd return `true` and upstream we'd raise an exception.

In the below code, the `extract_stats_for` is returning true, because
calls to `Rails.logger.info` return true.

```ruby
view_stats = extract_stats_for(object: file, from: FileViewStat, start_date: start_date, user: user)
stats = tally_results(view_stats, :views, stats) if view_stats.present?
```

This resulted in attempting to call `.each` on the `view_stats`; which
was true.

This builds on a [reported issue in Slack][1].

Closes #5873

[1]:https://samvera.slack.com/archives/C0F9JQJDQ/p1663608069939129
@dlpierce dlpierce merged commit b2e8828 into 3.x-stable Sep 30, 2022
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 this pull request may close these issues.

2 participants