diff --git a/app/models/research_output.rb b/app/models/research_output.rb index f32a221..b759372 100644 --- a/app/models/research_output.rb +++ b/app/models/research_output.rb @@ -24,7 +24,7 @@ include ValidationMessages - after_save :create_or_update_fragments + after_create :create_json_fragments after_destroy :destroy_json_fragment # ================ @@ -88,7 +88,7 @@ Fragment::ResearchOutput.where("(data->>'research_output_id')::int = ?", id).destroy_all end - def create_or_update_fragments + def create_json_fragments fragment = json_fragment dmp_fragment = plan.json_fragment @@ -115,6 +115,7 @@ parent_id: fragment.id, additional_info: {} ) + fragment_description.instantiate unless description_question.nil? # Create a new answer for the ResearchOutputDescription Question diff --git a/lib/tasks/madmpopidor.rake b/lib/tasks/madmpopidor.rake index c02d340..f5a508d 100644 --- a/lib/tasks/madmpopidor.rake +++ b/lib/tasks/madmpopidor.rake @@ -19,7 +19,7 @@ plan.research_outputs.each do |research_output| next if research_output.nil? && research_output.json_fragment.present? - research_output.create_or_update_fragments + research_output.create_json_fragments end end end