Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Adding rake task to migrate state property to Sipity #956

Merged
merged 4 commits into from
Jan 23, 2017

Conversation

escowles
Copy link
Member

Fixes #955

@eliotjordan
Copy link
Member

eliotjordan commented Jan 17, 2017

The task should probably set the resource.state to nil or Vocab::FedoraResourceStatus.active. Otherwise, CC is going to hide them by default.

@tpendragon
Copy link
Contributor

We should pull all the IDs from Solr and then ActiveFedora::Base.find each one, so we don't have to hold all those objects in memory.

@coveralls
Copy link

coveralls commented Jan 23, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 42cc622 on migrate-state into 8e2bed1 on 920-cc-2-0.

desc "Migrate state from the state property to Sipity"
task migrate: :environment do
['MultiVolumeWork', 'ScannedResource', 'ImageWork', 'RasterWork', 'VectorWork'].each do |model|
ActiveFedora::SolrService.get("has_model_ssim:#{model}")['response']['docs'].each do |doc|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simpler/faster would be

ActiveFedora::SolrService.query("has_model_ssim:#{model}", fl: "id").map{|x| x["id"]}.each do |id|

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 — I also noticed that I had book_works hardcoded, so I replaced that with a hash of workflows to models they contain.

@coveralls
Copy link

coveralls commented Jan 23, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling a74193c on migrate-state into 8e2bed1 on 920-cc-2-0.

@coveralls
Copy link

coveralls commented Jan 23, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 1c412b2 on migrate-state into 8e2bed1 on 920-cc-2-0.

@tpendragon tpendragon merged commit 4e7cad8 into 920-cc-2-0 Jan 23, 2017
@escowles escowles deleted the migrate-state branch January 27, 2017 17:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants