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

set date_created on each version as it is imported #2803

Merged
merged 1 commit into from
Oct 24, 2016
Merged

set date_created on each version as it is imported #2803

merged 1 commit into from
Oct 24, 2016

Conversation

carolyncole
Copy link
Contributor

@carolyncole carolyncole commented Oct 19, 2016

Fixes #2144. This PR sets the date so the work should now be complete.

Added new VersionUpdater to update the attribute before the version is created, which sets the metadata in stone

@projecthydra/sufia-code-reviewers

@awead
Copy link
Contributor

awead commented Oct 19, 2016

@Cam156 I'm wondering if we might make Hydra::Works::UploadFileToFileSet default to adding the current date time to a file's date_created. That way, subsequent versions of files added after migration would always have a value for date_created instead of just the ones we migrate.

@carolyncole
Copy link
Contributor Author

@awead created a ticket: samvera/hydra-works#310

@awead
Copy link
Contributor

awead commented Oct 19, 2016

awesome. I can pick that up.

@hackartisan
Copy link
Contributor

I got the following error when doing a test run via my exe script:

$ bunx sufia_import -u fedoraAdmin -p fedoraAdmin
bundler: failed to load command: sufia_import (/usr/local/lib/ruby/gems/2.2.0/bin/sufia_import)
RuntimeError: Can't get uri. Owner isn't saved
  /usr/local/lib/ruby/gems/2.2.0/gems/active-fedora-11.0.1/lib/active_fedora/associations/contains_association.rb:35:in `uri'
  /usr/local/lib/ruby/gems/2.2.0/gems/active-fedora-11.0.1/lib/active_fedora/associations/directly_contains_association.rb:24:in `container'
  /usr/local/lib/ruby/gems/2.2.0/gems/active-fedora-11.0.1/lib/active_fedora/associations/directly_contains_association.rb:35:in `initialize_attributes'
  /usr/local/lib/ruby/gems/2.2.0/gems/active-fedora-11.0.1/lib/active_fedora/associations/directly_contains_one_association.rb:29:in `add_to_container'
  /usr/local/lib/ruby/gems/2.2.0/gems/active-fedora-11.0.1/lib/active_fedora/associations/directly_contains_one_association.rb:39:in `replace'
  /usr/local/lib/ruby/gems/2.2.0/gems/active-fedora-11.0.1/lib/active_fedora/associations/singular_association.rb:48:in `new_record'
  /usr/local/lib/ruby/gems/2.2.0/gems/active-fedora-11.0.1/lib/active_fedora/associations/singular_association.rb:29:in `build'
  /usr/local/lib/ruby/gems/2.2.0/gems/hydra-works-0.14.0/lib/hydra/works/services/add_file_to_file_set.rb:69:in `find_or_create_file_for_symbol'
  /usr/local/lib/ruby/gems/2.2.0/gems/hydra-works-0.14.0/lib/hydra/works/services/add_file_to_file_set.rb:59:in `find_or_create_file'
  /usr/local/lib/ruby/gems/2.2.0/gems/hydra-works-0.14.0/lib/hydra/works/services/add_file_to_file_set.rb:28:in `initialize'
  /home/ubuntu/src/sufia/lib/sufia/import/add_version_to_file_set.rb:23:in `initialize'
  /home/ubuntu/src/sufia/lib/sufia/import/add_version_to_file_set.rb:15:in `new'
  /home/ubuntu/src/sufia/lib/sufia/import/add_version_to_file_set.rb:15:in `call'
  /home/ubuntu/src/sufia/lib/sufia/import/version_builder.rb:46:in `block in create'
  /home/ubuntu/src/sufia/lib/sufia/import/version_builder.rb:45:in `open'
  /home/ubuntu/src/sufia/lib/sufia/import/version_builder.rb:45:in `create'
  /home/ubuntu/src/sufia/lib/sufia/import/version_builder.rb:25:in `block in build'
  /home/ubuntu/src/sufia/lib/sufia/import/version_builder.rb:24:in `each'
  /home/ubuntu/src/sufia/lib/sufia/import/version_builder.rb:24:in `each_with_index'
  /home/ubuntu/src/sufia/lib/sufia/import/version_builder.rb:24:in `build'
  /home/ubuntu/src/sufia/lib/sufia/import/file_set_builder.rb:40:in `build'
  /home/ubuntu/src/sufia/lib/sufia/import/generic_file_translator.rb:32:in `import_file'
  /home/ubuntu/src/sufia/lib/sufia/import/generic_file_translator.rb:22:in `block in import'
  /home/ubuntu/src/sufia/lib/sufia/import/generic_file_translator.rb:22:in `each'
  /home/ubuntu/src/sufia/lib/sufia/import/generic_file_translator.rb:22:in `import'
  /home/ubuntu/src/sufia/exe/sufia_import:61:in `block in <top (required)>'
  /home/ubuntu/src/sufia/exe/sufia_import:58:in `each'
  /home/ubuntu/src/sufia/exe/sufia_import:58:in `<top (required)>'
  /usr/local/lib/ruby/gems/2.2.0/bin/sufia_import:23:in `load'
  /usr/local/lib/ruby/gems/2.2.0/bin/sufia_import:23:in `<top (required)>'

@carolyncole
Copy link
Contributor Author

@HackMasterA I had removed a line that I thought might not be needed. Your tests seem to show that it still is. Here https://github.com/projecthydra/sufia/pull/2803/files#diff-a89788817ebdbefb25061932f69b07e0R16

Give the new code a try and see if it fairs better. Thanks for thoroughly testing!

Added new VersionUpdater to update the attribute before the version is created, which sets the metadata in stone
@hackartisan
Copy link
Contributor

@Cam156 works now!

@hackartisan
Copy link
Contributor

hackartisan commented Oct 21, 2016

@Cam156 are you still working on this? Not sure what is up with the tests. (otherwise ready to merge)

@carolyncole
Copy link
Contributor Author

@HackMasterA Not sure what is going on it passes on travis in psu-stewardship: https://travis-ci.org/psu-stewardship/sufia. I restarted them

@mjgiarlo
Copy link
Member

I'm seeing lots of Travis ⌚ this morning.

@carolyncole
Copy link
Contributor Author

@HackMasterA all green

@hackartisan hackartisan merged commit bcfd5f9 into samvera-deprecated:7.2-migration Oct 24, 2016
@carolyncole carolyncole deleted the i#2144 branch October 24, 2016 13:04
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.

4 participants