[ARVADOS] updated: 1.3.0-601-g2a17d2144
Git user
git at public.curoverse.com
Tue Mar 26 21:03:02 UTC 2019
Summary of changes:
services/api/app/models/collection.rb | 12 ++++++++++++
1 file changed, 12 insertions(+)
via 2a17d214467d5302e97008618ef5f560ff1fd45b (commit)
from 661fbce61e9a150a0bfc5ab9dd5bff04afdd4286 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 2a17d214467d5302e97008618ef5f560ff1fd45b
Author: Eric Biagiotti <ebiagiotti at veritasgenetics.com>
Date: Tue Mar 26 17:02:56 2019 -0400
14484: Adds file count and size callback to the collection model
Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti at veritasgenetics.com>
diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 6147b79f9..2cebd5438 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -30,6 +30,7 @@ class Collection < ArvadosModel
validate :versioning_metadata_updates, on: :update
validate :past_versions_cannot_be_updated, on: :update
before_save :set_file_names
+ before_save :set_file_count_and_total_size
around_update :manage_versioning
api_accessible :user, extend: :common do |t|
@@ -51,6 +52,8 @@ class Collection < ArvadosModel
t.add :version
t.add :current_version_uuid
t.add :preserve_version
+ t.add :file_count
+ t.add :file_size_total
end
after_initialize do
@@ -195,6 +198,15 @@ class Collection < ArvadosModel
true
end
+ def set_file_count_and_total_size
+ if self.manifest_text_changed?
+ m = Keep::Manifest.new(self.manifest_text)
+ self.file_size_total = m.files_size
+ self.file_count = m.files_count
+ end
+ true
+ end
+
def manifest_files
return '' if !self.manifest_text
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list