diff --git a/app/models/intellectual_object.rb b/app/models/intellectual_object.rb index 4f9699a0..513f277b 100644 --- a/app/models/intellectual_object.rb +++ b/app/models/intellectual_object.rb @@ -79,9 +79,9 @@ def self.empty_param(param) end def bytes_by_format - stats = self.generic_files.sum(:size) + stats = self.active_files.sum(:size) if stats - cross_tab = self.generic_files.group(:file_format).sum(:size) + cross_tab = self.active_files.group(:file_format).sum(:size) cross_tab['all'] = stats cross_tab else diff --git a/app/models/work_item.rb b/app/models/work_item.rb index 0aa0e4be..bff150a2 100644 --- a/app/models/work_item.rb +++ b/app/models/work_item.rb @@ -224,7 +224,9 @@ def self.create_restore_request(intellectual_object_identifier, requested_by) if item.nil? raise ActiveRecord::RecordNotFound end + obj = IntellectualObject.with_identifier(intellectual_object_identifier).first restore_item = item.dup + restore_item.size = obj.gf_size restore_item.action = Pharos::Application::PHAROS_ACTIONS['restore'] restore_item = WorkItem.finish_restore_request(restore_item, requested_by, item) restore_item @@ -235,7 +237,9 @@ def self.create_glacier_restore_request(intellectual_object_identifier, requeste if item.nil? raise ActiveRecord::RecordNotFound end + obj = IntellectualObject.with_identifier(intellectual_object_identifier).first restore_item = item.dup + restore_item.size = obj.gf_size restore_item.action = Pharos::Application::PHAROS_ACTIONS['glacier_restore'] restore_item = WorkItem.finish_restore_request(restore_item, requested_by, item) restore_item @@ -253,7 +257,6 @@ def self.finish_restore_request(restore_item, requested_by, orig_item) restore_item.node = nil restore_item.pid = 0 restore_item.needs_admin_review = false - restore_item.size = orig_item.size restore_item.stage_started_at = nil restore_item.queued_at = nil restore_item.save!