Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions app/views/api/v0/plans/index.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@ json.array! @plans.each do |plan|
json.funder do
json.name(plan.template.org.funder? ? plan.template.org.name : plan.funder&.name)
end
json.principal_investigator do
investigator = plan.contributors.investigation.first

json.name investigator.name
json.email investigator.email
json.phone investigator.phone
investigator = plan.contributors.investigation.first
if investigator.present?
json.principal_investigator do
json.name investigator.name
json.email investigator.email
json.phone investigator.phone
end
end

data_contact = plan.contributors.data_curation.first || plan.owner
json.data_contact do
data_contact = plan.contributors.data_curation.first
json.name data_contact.name
json.name data_contact.is_a?(Contributor) ? data_contact.name : data_contact.name(false)
json.email data_contact.email
json.phone data_contact.phone
json.phone data_contact.phone if data_contact.is_a?(Contributor)
end
json.users plan.roles.each do |role|
json.email role.user.email
Expand Down