Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Error gone but notice not working yet

  • Loading branch information...
commit f689c52eb3b223247ff9734f0591848e17c36304 1 parent 750c049
@cjcolvar cjcolvar authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 app/models/file_upload_step.rb
View
9 app/models/file_upload_step.rb
@@ -23,7 +23,9 @@ def after_step context
def execute context
logger.debug "<< Processing FILE-UPLOAD step >>"
- update_master_files context[:mediaobject], context[:parts]
+ deleted_parts = update_master_files context[:mediaobject], context[:parts]
+ context[:notice] = "Several clean up jobs have been sent out. Their statuses can be viewed by your sysadmin at #{ Avalon::Configuration['matterhorn']['cleanup_log'] }" unless deleted_parts.empty?
+
# Reloads mediaobject.parts, should use .reload when we update hydra-head
media = MediaObject.find(context[:mediaobject].pid)
unless media.parts.empty?
@@ -41,6 +43,7 @@ def execute context
# label - Display label in the interface
# pid - Identifier for the masterFile to help with mapping
def update_master_files(mediaobject, files = [])
+ deleted_parts = []
if not files.blank?
files.each do |part|
logger.debug "<< #{part} >>"
@@ -49,9 +52,8 @@ def update_master_files(mediaobject, files = [])
if selected_part
if part[:remove]
logger.info "<< Deleting master file #{selected_part.pid} from the system >>"
+ deleted_parts << selected_part
selected_part.destroy
- context[:notice] = "Several clean up jobs have been sent out. Their statuses can be viewed by your sysadmin at #{ Avalon::Configuration['matterhorn']['cleanup_log'] }"
-
else
selected_part.label = part[:label]
selected_part.save
@@ -59,6 +61,7 @@ def update_master_files(mediaobject, files = [])
end
end
end
+ return deleted_parts
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.