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

DPUL Exhibits showing title only issues at end of browse all category #1433

Closed
1 of 3 tasks
kelea99 opened this issue Feb 11, 2023 · 3 comments
Closed
1 of 3 tasks

DPUL Exhibits showing title only issues at end of browse all category #1433

kelea99 opened this issue Feb 11, 2023 · 3 comments

Comments

@kelea99
Copy link
Contributor

kelea99 commented Feb 11, 2023

Summary

Lapidus DPUL exhibit is showing the title only ingests for MVWs (child volumes) at the end of the all search/browse all listing. This was a bug in the past. See screenshot as well.

https://dpul.princeton.edu/lapidus/feature/browse-the-collection?page=57

Thoughts

  1. attempt a reindex on monday to see if that fixes the issue. if not...
  2. have a look at the closed ticket for similar (same?) issue: Child volumes are showing up in search results #362

Impact

Please include hard deadlines, if the exhibit is part of an event, the issue is stopping work, etc.
This is a high profile exhibit that was recently highlighted in university articles about the Donor.

Priority recommendation

  • asap
  • within the next 3 weeks
  • PO will prioritize

Sudden Priority Justification

Required if "asap" or "within the next 3 weeks" is checked. Add "Sudden Priority" and "Maintenance/Research labels
High-profile DPUL exhibit.

Expected behaviour

Actual behaviour

Steps to reproduce behaviour

Screenshots

Screen Shot 2023-02-11 at 2 32 09 PM

@sdellis
Copy link
Member

sdellis commented Feb 20, 2023

Possible fix: We could remove collections from children for the Lapidus collection. Parents are not in collections and are not getting indexed. Parents should be assigned to the Sid Lapidus '59 Collection.

Example: https://figgy.princeton.edu/catalog/289a9501-f031-41ba-84b2-b9121fde5c13
Parent: https://figgy.princeton.edu/catalog/1000ce02-8e21-4527-8ebc-128ea673822d

@tpendragon tpendragon self-assigned this Feb 21, 2023
@tpendragon
Copy link
Contributor

tpendragon commented Feb 22, 2023

I'm kicking off a reindex, but this should be fixed.

Script:

# frozen_string_literal: true
class LapidusMigration
  def self.run
    csp = ChangeSetPersister.default
    qs = csp.query_service
    collection = qs.find_by(id: "9d481ffa-309a-4198-8bfa-cef0fd445494")
    children = Wayfinder.for(collection).members
    parents = []

    # get every collection member that has a parent.
    children_with_parents = children.select do |child|
      parent = Wayfinder.for(child).parent
      if parent.present?
        parents << parent
        true
      else
        false
      end
    end
    parents = parents.uniq(&:id).reject do |parent|
      parent.member_of_collection_ids.map(&:to_s).include?(collection.id.to_s)
    end
    puts "Children with Parents: #{children_with_parents.length}"
    puts "Parents without Collection: #{parents.length}"
    puts "Example Parent: #{parents.last&.id}"
    puts "Example Child: #{children_with_parents.first.id}"

    parents.each do |parent|
      puts "Adding collection to #{parent.id}"
      change_set = ChangeSet.for(parent)
      change_set.validate(append_collection_ids: [collection.id.to_s])
      csp.save(change_set: change_set)
    end

    children_with_parents.each do |child|
      change_set = ChangeSet.for(child)
      change_set.validate(remove_collection_ids: [collection.id.to_s])
      csp.save(change_set: change_set)
    end
  end
end

@kelea99
Copy link
Contributor Author

kelea99 commented Feb 22, 2023

Looks great, @tpendragon ! Closing ticket.

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

No branches or pull requests

3 participants