Open jkim-ru opened 6 years ago
I modified the Collection model, but I need to write a rake task to convert current multi-value notes to single-value.
I made this change to the feature/41/start-rspec-testing
branch (not ideal), but it's only complete. Once this issue is complete with a clean up rake task, then you can merge that branch to master.
A potential rake task might look like this:
# Run using: bundle exec rake vdc:convert_note_to_single_value:convert
namespace :vdc do
namespace :convert_note_to_single_value do
desc "Convert Vdc::Resource note properties to be single value. (Example: [] to '')"
task convert: :environment do
vdc_resources = Vdc::Resource.all
vdc_resources.each do |r|
if !r.note.nil?
if r.note.count > 0
r.note = r.note.first
else
r.note = ""
end
r.save
end
end
end
end
end
I ran out of time to test it out.
Note: Maybe this is okay as multi-value? May need to be discussed later.
According to Metadata spreadsheet on Sakai, this one should be single-valued (not multi-valued).