Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
hh1966
chemotion_eln_server
Commits
e59b260b
Commit
e59b260b
authored
Mar 21, 2019
by
hh1966
Browse files
Fix wellplate import
parent
83a2aee3
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/export/export_collections.rb
View file @
e59b260b
...
...
@@ -111,10 +111,6 @@ module Export
:molecule_id
=>
'Molecule'
,
:user_id
=>
'User'
})
fetch_one
(
sample
.
well
,
{
:sample_id
=>
'Sample'
,
:wellplate_id
=>
'Wellplate'
,
})
fetch_many
(
sample
.
residues
,
{
:sample_id
=>
'Sample'
,
})
...
...
@@ -173,6 +169,11 @@ module Export
# fetch containers and attachments
collection
.
wellplates
.
each
do
|
wellplate
|
fetch_many
(
wellplate
.
wells
,
{
:sample_id
=>
'Sample'
,
:wellplate_id
=>
'Wellplate'
,
})
fetch_containers
(
wellplate
)
end
end
...
...
lib/import/import_collections.rb
View file @
e59b260b
...
...
@@ -221,7 +221,7 @@ module Import
'updated_at'
).
merge
({
:wellplate
=>
@instances
.
fetch
(
'Wellplate'
).
fetch
(
fields
.
fetch
(
'wellplate_id'
)),
:sample
=>
@instances
.
fetch
(
'Sample'
).
fetch
(
fields
.
fetch
(
'sample_id'
))
:sample
=>
@instances
.
fetch
(
'Sample'
).
fetch
(
fields
.
fetch
(
'sample_id'
)
,
nil
)
}))
# add reaction to the @instances map
...
...
@@ -433,10 +433,13 @@ module Import
# Follows a has_many relation to `foreign_type` through `association_type`
def
fetch_many
(
foreign_type
,
association_type
,
local_field
,
foreign_field
,
local_id
)
associations
=
[]
@data
.
fetch
(
association_type
).
each
do
|
uuid
,
fields
|
@data
.
fetch
(
association_type
,
{}
).
each
do
|
uuid
,
fields
|
if
fields
.
fetch
(
local_field
)
==
local_id
foreign_id
=
fields
.
fetch
(
foreign_field
)
associations
<<
@instances
.
fetch
(
foreign_type
).
fetch
(
foreign_id
)
instance
=
@instances
.
fetch
(
foreign_type
,
{}).
fetch
(
foreign_id
,
nil
)
unless
instance
.
nil?
associations
<<
instance
end
end
end
return
associations
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment