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

Fixing Works Created Count Discrepency - #3478 #4494

Merged
merged 4 commits into from
Oct 7, 2020
Merged

Commits on Sep 15, 2020

  1. Adjusting logic to ensure use of local variable

    Prior to this commit, we could be passing the application controller's
    `params` instead of of the local variable `params`.  This could result
    in some unexpected behavior.
    
    Note, in SHA @b04c41d2772505d8a548c3fd48774a5642d3ac90 we went from:
    
    ```ruby
    params = { search_field: name, q: "\"#{value}\"" }
    state = search_state_with_facets(params, facet_hash)
    ```
    
    to
    
    ```ruby
    params = { search_field: name, q: "\"#{value}\"" } if name != ''
    state = search_state_with_facets(params, facet_hash)
    ```
    
    The prior change meant that instead of always having the local variable
    named `params`, we would sometimes fallback to the application's
    `params` method.
    
    I don't think this is a major issue, but one that could introduce some
    unexpected results.
    
    Related to #4322, #3478
    jeremyf committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    b0b5dc4 View commit details
    Browse the repository at this point in the history
  2. Introducing where clause for number_of_works()

    Based on some investigation around #3478, I suspect that the
    `Hyrax::WorkRelation#where` call that uses only a depositor field and
    user key is finding more results than the query run on the catalog
    search page.
    
    By adding the where clause, I hope to align the query logic of the
    `number_of_works` and the `link_to_field` on the [_vitals.html.erb][1] partial.
    
    Related to #3478
    
    [1]: https://github.com/samvera/hyrax/blob/b04c41d2772505d8a548c3fd48774a5642d3ac90/app/views/hyrax/users/_vitals.html.erb#L11-L12
    jeremyf committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    980dc92 View commit details
    Browse the repository at this point in the history
  3. Adding where clause to align counts on two pages

    On the "vitals" page, there is a count that we derive from
    `number_of_works`.  When you click on the `link_to_field` that new page
    also as a count based on the provided facets.  Prior to this commit, I
    believe the underlying queries were not using the same logic.
    
    With this change, I hope to bring this in alignment.
    
    Please note, I don't have tests to confirm this, nor a data state that
    would help confirm it.  So, I'm pushing up a change that I believe
    should work.
    
    My plan is to write some helper tests at a later date, but for now am
    drawing to the end of my work day.
    
    Related to #3478
    jeremyf committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    212cf16 View commit details
    Browse the repository at this point in the history
  4. Moving where clause into helper

    Per discussion on #4494, a view
    likely should not know about the Solr document field names.  This is
    better served in a helper.
    jeremyf committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    7abf757 View commit details
    Browse the repository at this point in the history