Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
gy4443
chemotion_eln_server
Commits
71b3464a
Commit
71b3464a
authored
Oct 13, 2015
by
Marco Sehrer
Browse files
Catch errors from SVG update
parent
7db83907
Changes
1
Show whitespace changes
Inline
Side-by-side
app/models/reaction.rb
View file @
71b3464a
...
...
@@ -71,18 +71,16 @@ class Reaction < ActiveRecord::Base
def
update_svg_file!
inchikeys
=
{}
inchikeys
[
:starting_materials
]
=
starting_materials
.
map
do
|
material
|
material
.
molecule
.
inchikey
end
inchikeys
[
:reactants
]
=
reactants
.
map
do
|
material
|
material
.
molecule
.
inchikey
end
inchikeys
[
:products
]
=
products
.
map
do
|
material
|
material
.
molecule
.
inchikey
end
inchikeys
[
:starting_materials
]
=
starting_materials
.
includes
(
:molecule
).
pluck
(
:'molecules.inchikey'
)
inchikeys
[
:reactants
]
=
reactants
.
includes
(
:molecule
).
pluck
(
:'molecules.inchikey'
)
inchikeys
[
:products
]
=
products
.
includes
(
:molecule
).
pluck
(
:'molecules.inchikey'
)
label
=
[
solvents
,
temperature
].
compact
.
join
(
', '
)
begin
composer
=
SVG
::
ReactionComposer
.
new
(
inchikeys
,
label:
label
)
self
.
reaction_svg_file
=
composer
.
compose_reaction_svg_and_save
rescue
Exception
=>
e
p
"**** SVG::ReactionComposer failed ***"
end
end
end
Write
Preview
Supports
Markdown
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