From dea4ed4e15693ccb5612cb188bfca6ad30d4dfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Zrim=C5=A1ek?= Date: Mon, 19 Nov 2018 04:26:57 +0100 Subject: [PATCH] Add model name to the archive folders in export-all ZIP structure [SCI-2817] --- app/models/team_zip_export.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/models/team_zip_export.rb b/app/models/team_zip_export.rb index 0e6f2f18d..88c57df57 100644 --- a/app/models/team_zip_export.rb +++ b/app/models/team_zip_export.rb @@ -144,14 +144,19 @@ class TeamZipExport < ZipExport # Create directory for project, experiment, or module def make_model_dir(parent_path, model, index) # For MyModule, the index indicates its position in project sidebar - model_name = format( - model.class == MyModule ? '(%s) %s' : '%s (%s)', - idx: index, name: to_filesystem_name(model.name) - ) + if model.class == MyModule + class_name = 'module' + model_format = '(%s) %s' + else + class_name = model.class.to_s.downcase.pluralize + model_format = '%s (%s)' + end + model_name = + format(model_format, idx: index, name: to_filesystem_name(model.name)) model_path = parent_path if model.archived - model_path += '/Archived' + model_path += "/Archived #{class_name}" FileUtils.mkdir_p(model_path) end model_path += "/#{model_name}"