Skip to content

Commit

Permalink
Merge pull request #3034 from DMPRoadmap/bug-496-plan-grant_number-bu…
Browse files Browse the repository at this point in the history
…g-found

Fix Plan grant_number bug
  • Loading branch information
briri committed Sep 23, 2021
2 parents 7ffe4de + 0b80c86 commit dab960f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/models/concerns/exportable_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ def prepare_coversheet_for_csv(csv, _headings, hash)
else
[_("Template: "), _("%{template}") % { template: hash[:template] + hash[:customizer] }]
end
if grant_number.present?
csv << [_("Grant number: "), _("%{grant_number}") % { grant_number: grant_number }]
if grant&.value.present?
csv << [_("Grant number: "), _("%{grant_number}") % { grant_number: grant&.value }]
end
if description.present?
csv << [_("Project abstract: "), _("%{description}") %
Expand Down
2 changes: 1 addition & 1 deletion app/models/exported_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def project_identifier
end

def grant_title
plan.grant_number
plan.grant&.value
end

def principal_investigator
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/v0/plans/index.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ json.prettify!
json.array! @plans.each do |plan|
json.id plan.id
json.title plan.title
json.grant_number plan.grant_number
json.grant_number plan.grant&.value
json.last_updated plan.updated_at
json.creation_date plan.created_at
json.test_plan plan.is_test?
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/v0/statistics/plans.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ json.prettify!

json.plans @org_plans.each do |plan|
json.id plan.id
json.grant_number plan.grant_number
json.grant_number plan.grant&.value
json.title plan.title
json.test_plan plan.is_test?

Expand Down
6 changes: 3 additions & 3 deletions app/views/shared/export/_plan_txt.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<% else %>
<%= _("Template: ") + @hash[:template] + @hash[:customizer] %>
<% end %>
<% if @plan.grant_number.present? %>
<%= _("Grant number: ") + @plan.grant_number %>
<% if @plan.grant&.value.present? %>
<%= _("Grant number: ") + @plan.grant&.value %>
<% end %>
<% if @plan.description.present? %>
<%= _("Project abstract: ") %>
Expand All @@ -31,7 +31,7 @@
<%= "#{section[:title]}\n" %>
<% end %>
<% section[:questions].each do |question| %>
<% if remove_list(@plan).include?(question[:id]) %>
<% if remove_list(@plan).include?(question[:id]) %>
<% next %>
<% end %>
<%# text in this case is an array to accomodate for option_based %>
Expand Down

0 comments on commit dab960f

Please sign in to comment.