Skip to content

Commit 386c4db

Browse files
author
John Pinto
committed
Updated app/models/concerns/exportable_plan.rb:
Changes for: - OpenAire functionality. - research_output_hash keys updated.
1 parent b2d3df3 commit 386c4db

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

app/models/concerns/exportable_plan.rb

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,37 @@ def prepare_research_outputs
152152
presenter = ResearchOutputPresenter.new(research_output: research_output)
153153
size_hash = presenter.converted_file_size(size: research_output.byte_size)
154154

155-
{
155+
research_output_hash = {
156156
title: research_output.title,
157157
description: research_output.description,
158158
type: presenter.display_type,
159-
anticipated_release_date: presenter.display_release,
160-
initial_access_level: presenter.display_access,
161-
intended_repositories: presenter.display_repository&.join(', '),
162-
anticipated_file_size: "#{size_hash[:size]} #{size_hash[:unit]&.upcase}",
163-
initial_license: presenter.display_license,
159+
release_date: presenter.display_release,
160+
access_level: presenter.display_access,
161+
repositories: presenter.display_repository&.join(', '),
162+
file_size: "#{size_hash[:size]} #{size_hash[:unit]&.upcase}",
163+
license: presenter.display_license,
164164
metadata_standards: presenter.display_metadata_standard&.join(', '),
165165
may_contain_sensitive_data: presenter.display_boolean(value: research_output.sensitive_data),
166166
may_contain_pii: presenter.display_boolean(value: research_output.personal_data)
167167
}
168+
169+
if Rails.configuration.x.open_aire.active
170+
# Convert the hash to a 2D array
171+
data = research_output_hash.to_a
172+
173+
# Define the new key-value pair
174+
new_key = :doi
175+
new_value = research_output.doi_url
176+
position = 2
177+
178+
# Insert the new key-value pair at the desired position
179+
data.insert(position, [new_key, new_value])
180+
181+
# Convert the array back to a hash
182+
research_output_hash = data.to_h
183+
end
184+
185+
research_output_hash
168186
end
169187
end
170188
# rubocop:enable Metrics/AbcSize

0 commit comments

Comments
 (0)