Skip to content
Snippets Groups Projects
Commit aafeefdc authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Fix workers query error

parent 4e3e1898
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ class DeleteBitstreamWorker
sidekiq_options queue: :dspace
def perform(attachment_id = nil)
attachment = LearningObject::Attachment.where(id: attachment_id)
attachment = LearningObject::Attachment.where(id: attachment_id).first
return false if attachment.blank? || !wait_bitstream(attachment)
# Require dspace gem
......
......@@ -27,7 +27,7 @@ class DspaceUploadWorker
def perform(learning_object_id, media_path, attachment_id = nil, description = nil)
# find learning object
learning_object = LearningObject.where(id: learning_object_id)
learning_object = LearningObject.where(id: learning_object_id).first
return false if learning_object.blank?
......@@ -48,7 +48,7 @@ class DspaceUploadWorker
def create_attachment(learning_object, bitstream, attachment_id = nil)
unless attachment_id.nil?
attachment = learning_object.attachments.where(id: attachment_id)
attachment = learning_object.attachments.where(id: attachment_id).first
unless attachment.blank?
attachment.update(map_bitstream2attachment(bitstream))
return attachment
......
......@@ -22,7 +22,7 @@ class ThumbnailGenerateWorker
sidekiq_options queue: :thumbnail
def perform(attachment_id, media_path = nil, force = false)
@attachment = ::LearningObject::Attachment.where(id: attachment_id)
@attachment = ::LearningObject::Attachment.where(id: attachment_id).first
return false if @attachment.blank? || (!@attachment.thumbnail.blank? && !force)
# object from dspace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment