Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/labimotion/libs/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def self.handle_response(oat, response, current_user = {}) # rubocop: disable Me
tmp_file.rewind

filename = oat.filename
name = "#{File.basename(filename, '.*')}.zip"
name = "#{File.basename(filename, '.*')}#{File.extname(filename) == '.zip' ? '.bagit.zip' : '.zip'}"
att = Attachment.new(
filename: name,
file_path: tmp_file.path,
Expand Down
4 changes: 2 additions & 2 deletions lib/labimotion/libs/nmr_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def process_ds(id, current_user = {})
return Labimotion::ConState::NONE if att.nil?

result = process(att)
return Labimotion::ConState::NONE if result.nil?
return Labimotion::ConState::WAIT if result.nil?

handle_process_result(result, att, id, current_user)
end
Expand Down Expand Up @@ -136,7 +136,7 @@ def handle_process_result(result, att, id, current_user)
if result[:is_bagit]
handle_bagit_result(att, id, current_user)
elsif invalid_metadata?(result)
Labimotion::ConState::NONE
Labimotion::ConState::WAIT
else
handle_nmr_result(result, att, current_user)
end
Expand Down
1 change: 1 addition & 0 deletions lib/labimotion/models/concerns/attachment_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def exec_converter
case con_state
when Labimotion::ConState::NMR
self.con_state = Labimotion::NmrMapper.process_ds(id, current_user)
return exec_converter if con_state == Labimotion::ConState::WAIT
update_column(:con_state, con_state)
when Labimotion::ConState::WAIT
self.con_state = Labimotion::Converter.jcamp_converter(id, current_user)
Expand Down