dibbs-vdc / ccql

Hyrax-based Ruby on Rails application for cataloging, committing, querying, and linking data related to the DIBBS Virtual Data Collaboratory (VDC) project.
Apache License 2.0
1 stars 1 forks source link

Collections Note should not be multi-valued #73

Open jkim-ru opened 6 years ago

jkim-ru commented 6 years ago

According to Metadata spreadsheet on Sakai, this one should be single-valued (not multi-valued).

jkim-ru commented 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.

jkim-ru commented 6 years ago

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.

jkim-ru commented 6 years ago

Note: Maybe this is okay as multi-value? May need to be discussed later.