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
b774dc60
Commit
b774dc60
authored
Sep 28, 2017
by
jasonych99
Browse files
Add Report Label - LIB
parent
0cf47e00
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/reporter/docx/detail_reaction.rb
View file @
b774dc60
...
@@ -7,6 +7,7 @@ module Reporter
...
@@ -7,6 +7,7 @@ module Reporter
@font_family
=
args
[
:font_family
]
@font_family
=
args
[
:font_family
]
@index
=
args
[
:index
]
||
0
@index
=
args
[
:index
]
||
0
@template
=
args
[
:template
]
@template
=
args
[
:template
]
@mol_serials
=
args
[
:mol_serials
]
||
[]
end
end
def
content
def
content
...
@@ -72,17 +73,16 @@ module Reporter
...
@@ -72,17 +73,16 @@ module Reporter
end
end
def
synthesis_title_delta
def
synthesis_title_delta
delta
=
[{
"
insert
"
=>
"[4.
#{
@index
+
1
}
] "
}]
delta
=
[{
'
insert
'
=>
"[4.
#{
@index
+
1
}
] "
}]
obj
.
products
.
each
do
|
p
|
obj
.
products
.
each
do
|
p
|
delta
=
delta
+
delta
=
delta
+
sample_molecule_name_delta
(
p
)
+
sample_molecule_name_delta
(
p
)
+
[{
"insert"
=>
" / "
}]
[{
'insert'
=>
' ('
}]
+
mol_serial_delta
(
p
[
:molecule
][
:id
])
+
[{
'insert'
=>
')'
}]
+
[{
'insert'
=>
', '
}]
end
end
delta
.
pop
delta
.
pop
delta
=
delta
+
[{
"insert"
=>
" ("
}]
+
[{
"attributes"
=>
{
"bold"
=>
"true"
},
"insert"
=>
"xx"
}]
+
[{
"insert"
=>
")"
}]
delta
delta
end
end
...
@@ -394,7 +394,7 @@ module Reporter
...
@@ -394,7 +394,7 @@ module Reporter
m
=
material_hash
(
material
,
false
)
m
=
material_hash
(
material
,
false
)
counter
+=
1
counter
+=
1
delta
+=
[{
"insert"
=>
"{
#{
alphabet
(
counter
)
}
|"
},
delta
+=
[{
"insert"
=>
"{
#{
alphabet
(
counter
)
}
|"
},
{
"attributes"
=>
{
"bold"
=>
"true"
},
"insert"
=>
"xx"
}
,
*
mol_serial_delta
(
material
[
:molecule
][
:id
])
,
{
"insert"
=>
"} "
},
{
"insert"
=>
"} "
},
*
sample_molecule_name_delta
(
m
),
*
sample_molecule_name_delta
(
m
),
{
"insert"
=>
" (
#{
m
[
:mass
]
}
g,
#{
m
[
:mol
]
}
mmol, "
+
{
"insert"
=>
" (
#{
m
[
:mass
]
}
g,
#{
m
[
:mol
]
}
mmol, "
+
...
@@ -413,7 +413,7 @@ module Reporter
...
@@ -413,7 +413,7 @@ module Reporter
p
=
material_hash
(
material
,
true
)
p
=
material_hash
(
material
,
true
)
counter
+=
1
counter
+=
1
delta
+=
[{
"insert"
=>
"{
#{
alphabet
(
counter
)
}
|"
},
delta
+=
[{
"insert"
=>
"{
#{
alphabet
(
counter
)
}
|"
},
{
"attributes"
=>
{
"bold"
=>
"true"
},
"insert"
=>
"xx"
}
,
*
mol_serial_delta
(
material
[
:molecule
][
:id
])
,
{
"insert"
=>
"} =
#{
p
[
:equiv
]
}
(
#{
p
[
:mass
]
}
g, "
+
{
"insert"
=>
"} =
#{
p
[
:equiv
]
}
(
#{
p
[
:mass
]
}
g, "
+
"
#{
p
[
:mol
]
}
mmol)"
},
"
#{
p
[
:mol
]
}
mmol)"
},
{
"insert"
=>
"; "
}]
{
"insert"
=>
"; "
}]
...
@@ -473,6 +473,16 @@ module Reporter
...
@@ -473,6 +473,16 @@ module Reporter
counter
=
counter
>=
1
&&
counter
<=
26
?
counter
-
1
:
25
counter
=
counter
>=
1
&&
counter
<=
26
?
counter
-
1
:
25
alphabets
[
counter
]
alphabets
[
counter
]
end
end
def
mol_serial
(
mol_id
)
s
=
@mol_serials
.
select
{
|
x
|
x
[
'mol'
]
&&
x
[
'mol'
][
'id'
]
==
mol_id
}[
0
]
s
.
present?
&&
s
[
'value'
].
present?
&&
s
[
'value'
]
||
'xx'
end
def
mol_serial_delta
(
mol_id
)
serial
=
mol_serial
(
mol_id
)
[{
'insert'
=>
serial
}]
end
end
end
end
end
end
end
lib/reporter/docx/document.rb
View file @
b774dc60
...
@@ -11,6 +11,7 @@ module Reporter
...
@@ -11,6 +11,7 @@ module Reporter
@img_format
=
args
[
:img_format
]
@img_format
=
args
[
:img_format
]
@font_family
=
args
[
:font_family
]
@font_family
=
args
[
:font_family
]
@template
=
args
[
:template
]
@template
=
args
[
:template
]
@mol_serials
=
args
[
:mol_serials
]
end
end
def
convert
def
convert
...
@@ -33,7 +34,8 @@ module Reporter
...
@@ -33,7 +34,8 @@ module Reporter
last_id:
last_id
,
last_id:
last_id
,
img_format:
@img_format
,
img_format:
@img_format
,
font_family:
@font_family
,
font_family:
@font_family
,
template:
@template
template:
@template
,
mol_serials:
@mol_serials
,
).
content
).
content
end
end
...
...
lib/reporter/si_worker.rb
View file @
b774dc60
...
@@ -16,7 +16,8 @@ module Reporter
...
@@ -16,7 +16,8 @@ module Reporter
configs:
@configs
,
configs:
@configs
,
img_format:
img_format
,
img_format:
img_format
,
font_family:
"Times New Roman"
,
font_family:
"Times New Roman"
,
template:
"supporting_information"
template:
"supporting_information"
,
mol_serials:
@mol_serials
).
convert
).
convert
end
end
...
@@ -28,7 +29,8 @@ module Reporter
...
@@ -28,7 +29,8 @@ module Reporter
configs:
procedure_config
,
configs:
procedure_config
,
img_format:
img_format
,
img_format:
img_format
,
font_family:
"Times New Roman"
,
font_family:
"Times New Roman"
,
template:
"supporting_information"
template:
"supporting_information"
,
mol_serials:
@mol_serials
).
convert
).
convert
end
end
...
...
lib/reporter/worker.rb
View file @
b774dc60
...
@@ -10,6 +10,7 @@ module Reporter
...
@@ -10,6 +10,7 @@ module Reporter
@configs
=
@report
.
configs
@configs
=
@report
.
configs
@img_format
=
@report
.
img_format
@img_format
=
@report
.
img_format
@template_path
=
args
[
:template_path
]
@template_path
=
args
[
:template_path
]
@mol_serials
=
@report
.
mol_serials
end
end
def
process
def
process
...
...
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