mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-11 01:14:30 +08:00
Merge pull request #1138 from okriuchykhin/ok_SCI_2404
Disable some validations in repository import to improve speed [SCI-2404]
This commit is contained in:
commit
a7547b9775
3 changed files with 6 additions and 2 deletions
|
@ -83,7 +83,7 @@ GEM
|
|||
activemodel (= 5.1.1)
|
||||
activesupport (= 5.1.1)
|
||||
arel (~> 8.0)
|
||||
activerecord-import (0.22.0)
|
||||
activerecord-import (0.23.0)
|
||||
activerecord (>= 3.2)
|
||||
activesupport (5.1.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
class RepositoryCell < ActiveRecord::Base
|
||||
attr_accessor :importing
|
||||
|
||||
belongs_to :repository_row
|
||||
belongs_to :repository_column
|
||||
belongs_to :value, polymorphic: true,
|
||||
|
@ -28,7 +30,8 @@ class RepositoryCell < ActiveRecord::Base
|
|||
validates :repository_column, presence: true
|
||||
validate :repository_column_data_type
|
||||
validates :repository_row,
|
||||
uniqueness: { scope: :repository_column }
|
||||
uniqueness: { scope: :repository_column },
|
||||
unless: :importing
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ module RepositoryImportParser
|
|||
cell_value_resolver.column_list_items_size
|
||||
end
|
||||
next if cell_value.nil? # checks the case if we reach items limit
|
||||
cell_value.repository_cell.importing = true
|
||||
unless cell_value.valid?
|
||||
errors = true
|
||||
raise ActiveRecord::Rollback
|
||||
|
|
Loading…
Reference in a new issue