-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue202: Add contributor to the DMP downloaded files #206
Changes from 3 commits
f0643fb
b74dd0c
8b8a056
d999544
48a3b50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,11 @@ def prepare_coversheet | |
attribution << role.user.name(false) | ||
end | ||
hash[:attribution] = attribution | ||
#ISSUE205: add contributor to cover page | ||
hash[:data_curation] = Contributor.where(:plan_id => id).data_curation | ||
hash[:investigation] = Contributor.where(:plan_id => id).investigation | ||
hash[:pa] = Contributor.where(:plan_id => id).project_administration | ||
hash[:other] = Contributor.where(:plan_id => id).other | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as comments above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
|
||
# Org name of plan owner's org | ||
hash[:affiliation] = owner.present? ? owner.org.name : "" | ||
|
@@ -127,12 +132,25 @@ def prepare_coversheet | |
|
||
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize | ||
def prepare_coversheet_for_csv(csv, _headings, hash) | ||
csv << [_("Title: "), _("%{title}") % { title: title }] | ||
csv << [if hash[:attribution].many? | ||
_("Creators: ") | ||
else | ||
_("Creator:") | ||
end, _("%{authors}") % { authors: hash[:attribution].join(", ") }] | ||
csv << ["Affiliation: ", _("%{affiliation}") % { affiliation: hash[:affiliation] }] | ||
if hash[:investigation].present? | ||
csv << [_("Principal Investigator: "), _("%{investigation}") % { investigation: hash[:investigation].map(&:name).join(', ') }] | ||
end | ||
if hash[:data_curation].present? | ||
csv << [_("Date Manager: "), _("%{data_curation}") % { data_curation: hash[:data_curation].map(&:name).join(', ') }] | ||
end | ||
if hash[:pa].present? | ||
csv << [_("Project Administrator: "), _("%{pa}") % { pa: hash[:pa].map(&:name).join(', ') }] | ||
end | ||
if hash[:other].present? | ||
csv << [_("Contributor: "), _("%{other}") % { other: hash[:other].map(&:name).join(', ') }] | ||
end | ||
csv << [_("Affiliation: "), _("%{affiliation}") % { affiliation: hash[:affiliation] }] | ||
lagoan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
csv << if hash[:funder].present? | ||
[_("Template: "), _("%{funder}") % { funder: hash[:funder] }] | ||
else | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,21 @@ | |
<%# Allow raw html (==) for plan_attribution as it has <b> tags %> | ||
<p><%== plan_attribution(@hash[:attribution]) %></p><br> | ||
|
||
<%# ISSUE205: print out contributors if exit %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as comment about referencing repository issues. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
<%# Roles are ranked by PI -> DM -> PA -> Other (if any) %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good explanation of the behaviour of the view! |
||
<% if @hash[:investigation].present? %> | ||
<p><b><%= _("Principal Investigator: ") %></b><%= @hash[:investigation].map(&:name).join(', ') %></p><br> | ||
<% end %> | ||
<% if @hash[:data_curation].present? %> | ||
<p><b><%= _("Data Manager: ") %></b><%= @hash[:data_curation].map(&:name).join(', ') %></p><br> | ||
<% end %> | ||
<% if @hash[:pa].present? %> | ||
<p><b><%= _("Project Administrator: ") %></b><%= @hash[:pa].map(&:name).join(', ') %></p><br> | ||
<% end %> | ||
<% if @hash[:other].present? %> | ||
<p><b><%= _("Contributor: ") %></b><%= @hash[:other].map(&:name).join(', ') %></p><br> | ||
<% end %> | ||
|
||
<p><b><%= _("Affiliation: ") %></b><%= @hash[:affiliation] %></p><br> | ||
|
||
<% if @hash[:funder].present? %> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
<%= "#{@plan.title}" %> | ||
<%= "----------------------------------------------------------\n" %> | ||
<% if @show_coversheet %> | ||
|
||
<%= @hash[:attribution].many? ? _("Creators: ") : _('Creator:') %> <%= @hash[:attribution].join(', ') %> | ||
<%# ISSUE205: print out contributors if exit %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
<%# Roles are ranked by PI -> DM -> PA -> Other (if any) %> | ||
<% if @hash[:investigation].present? %> | ||
<%= _("Principal Investigator: ") + @hash[:investigation].map(&:name).join(', ') %> | ||
<% end %> | ||
<% if @hash[:data_curation].present? %> | ||
<%= _("Data Manager: ") + @hash[:data_curation].map(&:name).join(', ') %> | ||
<% end %> | ||
<% if @hash[:pa].present? %> | ||
<%= _("Project Administrator: ") + @hash[:pa].map(&:name).join(', ') %> | ||
<% end %> | ||
<% if @hash[:other].present? %> | ||
<%= _("Contributor: ") + @hash[:other].map(&:name).join(', ') %> | ||
<% end %> | ||
<%= _("Affiliation: ") + @hash[:affiliation] %> | ||
<% if @hash[:funder].present? %> | ||
<%= _("Template: ") + @hash[:funder] %> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add explanation to the behaviour of the code instead of referencing the issue number of the repository. If we ever change repositories the issue number will no longer make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was also considering this. I submitted the issue DMPRoadmap#3179 to DMPRoadmap because our current way of testing is not tracking the downloaded file, instead, it is just tracking the original page source.
So far I haven't figured out the best way of asking RSpec to track the content of the 'downloaded file' (i.e. docx, csv, pdf..) because it is part of the user's computer instead of the rails program. I will continue to think about it. Please let me know if you know anything I can refer it.