mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-06 15:05:26 +08:00
Fix path creation and construction for export-all [SCI-2817]
This commit is contained in:
parent
f23160ba6d
commit
6ff117d662
1 changed files with 7 additions and 8 deletions
|
@ -46,15 +46,13 @@ class TeamZipExport < ZipExport
|
||||||
team_path = "#{tmp_dir}/#{to_filesystem_name(@team.name)}"
|
team_path = "#{tmp_dir}/#{to_filesystem_name(@team.name)}"
|
||||||
FileUtils.mkdir_p(team_path)
|
FileUtils.mkdir_p(team_path)
|
||||||
|
|
||||||
# Create explicit folder for archived projects
|
|
||||||
FileUtils.mkdir_p("#{team_path}/Archived projects")
|
|
||||||
|
|
||||||
# Iterate through every project
|
# Iterate through every project
|
||||||
data.each_with_index do |(_, p), ind|
|
data.each_with_index do |(_, p), ind|
|
||||||
obj_filenames = { my_module_repository: {}, step_asset: {},
|
obj_filenames = { my_module_repository: {}, step_asset: {},
|
||||||
step_table: {}, result_asset: {}, result_table: {} }
|
step_table: {}, result_asset: {}, result_table: {} }
|
||||||
|
|
||||||
project_path = make_model_dir(team_path, p, ind)
|
project_path = make_model_dir(team_path, p, ind)
|
||||||
|
project_name = project_path.split('/')[-1]
|
||||||
|
|
||||||
# Change current dir for correct generation of relative links
|
# Change current dir for correct generation of relative links
|
||||||
Dir.chdir(project_path)
|
Dir.chdir(project_path)
|
||||||
|
@ -76,9 +74,6 @@ class TeamZipExport < ZipExport
|
||||||
save_inventories_to_csv(inventories, repo, curr_repo_rows, repo_idx)
|
save_inventories_to_csv(inventories, repo, curr_repo_rows, repo_idx)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Create explicit folder for archived experiments
|
|
||||||
FileUtils.mkdir_p("#{team_path}/Archived experiments")
|
|
||||||
|
|
||||||
# Include all experiments
|
# Include all experiments
|
||||||
p.experiments.each_with_index do |ex, ex_ind|
|
p.experiments.each_with_index do |ex, ex_ind|
|
||||||
experiment_path = make_model_dir(project_path, ex, ex_ind)
|
experiment_path = make_model_dir(project_path, ex, ex_ind)
|
||||||
|
@ -145,11 +140,15 @@ class TeamZipExport < ZipExport
|
||||||
# Create directory for project, experiment, or module
|
# Create directory for project, experiment, or module
|
||||||
def make_model_dir(parent_path, model, index)
|
def make_model_dir(parent_path, model, index)
|
||||||
model_name = format(
|
model_name = format(
|
||||||
model.class == MyModule ? '(%<idx>) %<name>' : '%<name> (%<idx>)',
|
model.class == MyModule ? '(%<idx>s) %<name>s' : '%<name>s (%<idx>s)',
|
||||||
idx: index, name: to_filesystem_name(model.name)
|
idx: index, name: to_filesystem_name(model.name)
|
||||||
)
|
)
|
||||||
|
|
||||||
model_path = parent_path
|
model_path = parent_path
|
||||||
model_path += '/Archived' if model.archived
|
if model.archived
|
||||||
|
model_path += '/Archived'
|
||||||
|
FileUtils.mkdir_p(model_path)
|
||||||
|
end
|
||||||
model_path += "/#{model_name}"
|
model_path += "/#{model_name}"
|
||||||
FileUtils.mkdir_p(model_path)
|
FileUtils.mkdir_p(model_path)
|
||||||
model_path
|
model_path
|
||||||
|
|
Loading…
Reference in a new issue