Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
switched obj bytes_by_format to use active_files, made object restore…
Browse files Browse the repository at this point in the history
… request work items use object total file size, not latest_ingested work item size
  • Loading branch information
kelly-croswell committed Sep 12, 2019
1 parent 096f30e commit 3783a5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/intellectual_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion app/models/work_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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!
Expand Down

0 comments on commit 3783a5e

Please sign in to comment.