mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 11:57:16 +08:00
Fix forms items NA [SCI-11844]
This commit is contained in:
parent
19e6b0740e
commit
0610fb347b
1 changed files with 7 additions and 5 deletions
|
@ -21,13 +21,15 @@ class FormRepositoryRowsFieldValue < FormFieldValue
|
||||||
before_save :attach_snapshot_files
|
before_save :attach_snapshot_files
|
||||||
|
|
||||||
def attach_snapshot_files
|
def attach_snapshot_files
|
||||||
# find asset values and attach file blobs
|
if data.present?
|
||||||
data.map { |r| r['repository_cells'] }.flatten.filter { |c| c['value_type'] == 'RepositoryAssetValue' }.each do |c|
|
# find asset values and attach file blobs
|
||||||
blob_id = c.dig('repository_asset_value', 'asset', 'file', 'blob', 'id')
|
data.map { |r| r['repository_cells'] }.flatten.filter { |c| c['value_type'] == 'RepositoryAssetValue' }.each do |c|
|
||||||
|
blob_id = c.dig('repository_asset_value', 'asset', 'file', 'blob', 'id')
|
||||||
|
|
||||||
next if snapshot_files.find { |f| f.blob.id == blob_id }
|
next if snapshot_files.find { |f| f.blob.id == blob_id }
|
||||||
|
|
||||||
snapshot_files.attach(ActiveStorage::Blob.find(blob_id))
|
snapshot_files.attach(ActiveStorage::Blob.find(blob_id))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue