Skip to content

Commit

Permalink
fix for incorrect attribute in DOI metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
stkenny committed Jan 14, 2025
1 parent 1e5e5a6 commit d446a2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/controllers/objects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,9 @@ def save_and_index

DRI::DigitalObject.transaction do
if doi
doi.update_metadata(update_params.select { |key, _value| doi.metadata_fields.include?(key) })
doi_params = update_params.select { |key, _value| doi.metadata_fields.include?(key) }
doi_params[:resource_type] = doi_params.delete(:type) if doi_params.key?(:type)
doi.update_metadata(doi_params)
new_doi_if_required(@object, doi, 'metadata updated')
end

Expand Down
3 changes: 2 additions & 1 deletion spec/controllers/objects_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class << @file
)
)
Settings.doi.enable = true

puts @object.type
@object.status = "published"
@object.save
doi = DataciteDoi.create(object_id: @object.alternate_id)
Expand Down Expand Up @@ -440,6 +440,7 @@ class << @file
params[:digital_object][:title] = ["An Audio Title"]
params[:digital_object][:read_users_string] = "public"
params[:digital_object][:edit_users_string] = @login_user.email
params[:digital_object][:type] = @object.type
expect {
put :update, params: { id: @object.alternate_id, digital_object: params[:digital_object] }
}.to change{ DataciteDoi.count }.by(0)
Expand Down

0 comments on commit d446a2d

Please sign in to comment.