mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-14 09:04:56 +08:00
Fix code styling [SCI-2939]
This commit is contained in:
parent
05edfae766
commit
f7b73c617a
4 changed files with 10 additions and 5 deletions
|
@ -156,7 +156,7 @@ class TeamImporter
|
|||
project = Project.find_by_id(project_id)
|
||||
experiment_json = JSON.parse(File.read("#{@import_dir}/experiment.json"))
|
||||
|
||||
# Handle situation when experimaent with same name already exists
|
||||
# Handle situation when experiment with same name already exists
|
||||
exp_name = experiment_json.dig('experiment', 'name')
|
||||
if project.experiments.where(name: exp_name).present?
|
||||
experiment_names = project.experiments.map(&:name)
|
||||
|
|
|
@ -13,7 +13,7 @@ class TemplatesService
|
|||
end
|
||||
|
||||
def update_project(project)
|
||||
return unless project.template == true
|
||||
return unless project.template
|
||||
owner = project.user_projects
|
||||
.where(role: 'owner')
|
||||
.order(:created_at)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddProjectTemplates < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :projects, :template, :boolean
|
||||
|
|
|
@ -109,16 +109,19 @@ namespace :data do
|
|||
end
|
||||
|
||||
desc 'Export experiment to directory'
|
||||
task :experiment_template_export, [:experiment_id] => [:environment] do |_, args|
|
||||
task :experiment_template_export,
|
||||
[:experiment_id] => [:environment] do |_, args|
|
||||
Rails.logger.info(
|
||||
"Exporting experiment template with ID:#{args[:experiment_id]} to directory in tmp"
|
||||
"Exporting experiment template with ID:#{args[:experiment_id]} "\
|
||||
"to directory in tmp"
|
||||
)
|
||||
ee = ModelExporters::ExperimentExporter.new(args[:experiment_id])
|
||||
ee&.export_template_to_dir
|
||||
end
|
||||
|
||||
desc 'Import experiment from directory to given project'
|
||||
task :experiment_template_import, %i(dir_path project_id user_id) => [:environment] do |_, args|
|
||||
task :experiment_template_import,
|
||||
%i(dir_path project_id user_id) => [:environment] do |_, args|
|
||||
Rails.logger.info(
|
||||
"Importing experiment from directory #{args[:dir_path]}"
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue