mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-17 14:19:05 +08:00
Merge pull request #7660 from aignatov-bio/ai-sci-10801-fix-cells-preview-mapping
Fix cells preview mapping [SCI-10801]
This commit is contained in:
commit
6cd68e6c09
1 changed files with 7 additions and 4 deletions
|
|
@ -129,8 +129,6 @@ module RepositoryImportParser
|
||||||
include: [:repository_cells]
|
include: [:repository_cells]
|
||||||
).as_json
|
).as_json
|
||||||
|
|
||||||
p changes
|
|
||||||
|
|
||||||
{ status: :ok, nr_of_added: @new_rows_added, total_nr: @total_new_rows, changes: changes,
|
{ status: :ok, nr_of_added: @new_rows_added, total_nr: @total_new_rows, changes: changes,
|
||||||
import_date: I18n.l(Date.today, format: :full_date) }
|
import_date: I18n.l(Date.today, format: :full_date) }
|
||||||
end
|
end
|
||||||
|
|
@ -152,7 +150,7 @@ module RepositoryImportParser
|
||||||
|
|
||||||
if @preview
|
if @preview
|
||||||
repository_row.validate
|
repository_row.validate
|
||||||
repository_row.id = SecureRandom.uuid unless repository_row.id.present? # ID required for preview with serializer
|
repository_row.id = SecureRandom.uuid.gsub(/[a-zA-Z-]/, '') unless repository_row.id.present? # ID required for preview with serializer
|
||||||
else
|
else
|
||||||
repository_row.save!
|
repository_row.save!
|
||||||
end
|
end
|
||||||
|
|
@ -245,7 +243,12 @@ module RepositoryImportParser
|
||||||
# Create new cell
|
# Create new cell
|
||||||
cell_value.repository_cell.value = cell_value
|
cell_value.repository_cell.value = cell_value
|
||||||
repository_row.repository_cells << cell_value.repository_cell
|
repository_row.repository_cells << cell_value.repository_cell
|
||||||
@preview ? cell_value.validate : cell_value.save!
|
if @preview
|
||||||
|
cell_value.validate
|
||||||
|
cell_value.repository_cell.id = SecureRandom.uuid.gsub(/[a-zA-Z-]/, '') unless cell_value.repository_cell.id.present? # ID required for preview with serializer
|
||||||
|
else
|
||||||
|
cell_value.save!
|
||||||
|
end
|
||||||
@updated ||= true
|
@updated ||= true
|
||||||
cell_value.repository_cell
|
cell_value.repository_cell
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue