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
bda77dbb
Commit
bda77dbb
authored
Apr 13, 2019
by
hh1966
Browse files
Fix reaction_svg_file import
parent
ddb46ef7
Pipeline
#45275
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/import/import_collections.rb
View file @
bda77dbb
...
...
@@ -82,12 +82,6 @@ module Import
end
def
import_samples
# molecule_name_uuid = fields.fetch('molecule_name_id')
# molecule_name_fields = @data.fetch('MoleculeName').fetch(molecule_name_uuid)
# puts molecule_name_fields
@data
.
fetch
(
'Sample'
,
{}).
each
do
|
uuid
,
fields
|
# look for the molecule_name
molecule_name_uuid
=
fields
.
fetch
(
'molecule_name_id'
)
...
...
@@ -186,12 +180,17 @@ module Import
).
merge
({
:created_by
=>
@current_user_id
,
:collections
=>
fetch_many
(
'Collection'
,
'CollectionsReaction'
,
'reaction_id'
,
'collection_id'
,
uuid
),
:reaction_svg_file
=>
fetch_image
(
'reactions'
,
fields
.
fetch
(
'reaction_svg_file'
))
'Collection'
,
'CollectionsReaction'
,
'reaction_id'
,
'collection_id'
,
uuid
)
}))
# create the root container like with samples
reaction
.
container
=
Container
.
create_root_container
# overwrite with the image from the import, this needs to be at the end
# because otherwise Reaction:update_svg_file! would create an empty image again
reaction
.
reaction_svg_file
=
fetch_reaction_image
(
fields
.
fetch
(
'reaction_svg_file'
))
# save the instance again
reaction
.
save!
# add reaction to the @instances map
...
...
@@ -459,6 +458,18 @@ module Import
end
end
def
fetch_reaction_image
(
image_file_name
)
unless
image_file_name
.
nil?
or
image_file_name
.
empty?
import_file_path
=
File
.
join
(
@directory
,
'images'
,
image_file_name
)
if
File
.
exists?
(
import_file_path
)
File
.
open
(
import_file_path
)
do
|
f
|
f
.
read
()
end
end
end
end
def
update_instances!
(
uuid
,
instance
)
type
=
instance
.
class
.
name
...
...
hh1966
@hh1966
mentioned in issue
#4 (closed)
·
Apr 13, 2019
mentioned in issue
#4 (closed)
mentioned in issue #4
Toggle commit list
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