diff --git a/app/helpers/madmp_export_helper.rb b/app/helpers/madmp_export_helper.rb index 346755f..3361c64 100644 --- a/app/helpers/madmp_export_helper.rb +++ b/app/helpers/madmp_export_helper.rb @@ -10,11 +10,11 @@ JSON.load(File.open(export_format)) end - def format_contributors(dmp_fragment) + def format_contributors(dmp_fragment, selected_research_outputs) contributors = [] dmp_fragment.persons.each do |person| contributor = person.get_full_fragment - contributor["role"] = person.roles.uniq + contributor["role"] = person.roles(selected_research_outputs).uniq contributors.append(contributor) unless contributor["role"].empty? end contributors diff --git a/app/views/branded/shared/export/madmp_export_templates/default/plan.jbuilder b/app/views/branded/shared/export/madmp_export_templates/default/plan.jbuilder index eaf1b97..c6f2c7c 100644 --- a/app/views/branded/shared/export/madmp_export_templates/default/plan.jbuilder +++ b/app/views/branded/shared/export/madmp_export_templates/default/plan.jbuilder @@ -8,7 +8,7 @@ json.meta meta.get_full_fragment json.project project.get_full_fragment -json.contributor format_contributors(dmp) +json.contributor format_contributors(dmp, selected_research_outputs) json.researchOutputs research_outputs do |research_output| next unless selected_research_outputs.include?(research_output.data["research_output_id"])