Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It's useful to periodically check that all publicly available works have rights statements. As of summer Summer 2018 this was in fact true, but if you want to quickly check for the ID's of any public works that still need rights statements, log onto jobs_stage or jobs_production, open a console (see "Inspect Stuff" above) and paste the following directly into the console:

GenericWork.search_in_batches('read_access_group_ssim'=>'public') do |group|
group.each do |gw|
if gw["rights_tesim"] == nil || gw["rights_tesim"].count == 0
puts gw["id"]
end #if
end #group.each
end #search_in_batches

Adding and removing items from large collections

This is a known bug as of Summer 2018. See https://github.com/sciencehistory/chf-sufia/issues/1068 for more details about this. We seldom need this functionality, but if you do, here's how to do it in the Rails console.

Assuming the work you want to add or remove has ID work_id and the collection you want to add it to or remove it from has id collection_id,

Removing:

the_collection = Collection.find(collection_id)
the_collection.members.delete(GenericWork.find(work_id))
the_collection.save

Adding:

the_collection = Collection.find(collection_id)
the_collection.members.push(GenericWork.find(work_id))
the_collection.save

For large collections, expect these operations to take five to ten minutes and place considerable load on the server.