labimotion 1.2.0.1 → 1.3.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/labimotion/collection/import.rb +3 -3
- data/lib/labimotion/libs/export_element1.rb +200 -0
- data/lib/labimotion/libs/export_element_bak1.rb +118 -0
- data/lib/labimotion/utils/field_type.rb +1 -0
- data/lib/labimotion/utils/import_utils.rb +16 -22
- data/lib/labimotion/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f43e928ba8d3a20237af9a587380be1a674074d8323f1b41ecedff3d3416c12b
|
4
|
+
data.tar.gz: 344ae75f2cee3560d9f18e2f167e2321310ae539735cfc74666182868db369fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cfe38fdd248d4fb4f32be1c607605a0a35c6f262dc0e0cb33bd7575895aea6cd177b752f9b888458af7d75dffe45acf05f08a44a352389b0bd9f93a0cc27fc9
|
7
|
+
data.tar.gz: b7cfc290285914a6b4afddbb604718d5aeace21b8cbda8fa08aa8557e7513c5efa24829a79d39d71e59a937b9ce104623b30afea85c7f70191304b33d68e4a42
|
@@ -89,7 +89,7 @@ module Labimotion
|
|
89
89
|
sk_id = sk_obj["identifier"]
|
90
90
|
ek_obj = data.fetch(Labimotion::Prop::L_ELEMENT_KLASS).fetch(sk_obj["element_klass_id"])
|
91
91
|
element_klass = Labimotion::ElementKlass.find_by(name: ek_obj['name']) if ek_obj.present?
|
92
|
-
next if element_klass.nil? || ek_obj.nil? || ek_obj['is_generic'] == true
|
92
|
+
next if element_klass.nil? || ek_obj.nil? # || ek_obj['is_generic'] == true
|
93
93
|
|
94
94
|
element_uuid = fields.fetch('element_id')
|
95
95
|
element_type = fields.fetch('element_type')
|
@@ -99,7 +99,7 @@ module Labimotion
|
|
99
99
|
|
100
100
|
if segment_klass.nil?
|
101
101
|
skr = Labimotion::SegmentKlassesRevision.find_by(uuid: fields.fetch('klass_uuid'))
|
102
|
-
segment_klass = skr.
|
102
|
+
segment_klass = Labimotion::SegmentKlass.find_by(id: skr.segment_klass_id) if skr.present?
|
103
103
|
end
|
104
104
|
|
105
105
|
next if segment_klass.nil? || element.nil?
|
@@ -133,7 +133,7 @@ module Labimotion
|
|
133
133
|
data.fetch('Labimotion::Element', {}).each do |uuid, fields|
|
134
134
|
klass_id = fields["element_klass_id"]
|
135
135
|
ek_obj = data.fetch('Labimotion::ElementKlass', {})[klass_id]
|
136
|
-
ek_id = ek_obj["identifier"]
|
136
|
+
ek_id = ek_obj["identifier"] if ek_obj.present?
|
137
137
|
element_klass = Labimotion::ElementKlass.find_by(identifier: ek_id) if ek_id.present?
|
138
138
|
element_klass = Labimotion::ElementKlass.find_by(uuid: fields.fetch('klass_uuid')) if element_klass.nil?
|
139
139
|
|
@@ -0,0 +1,200 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'export_table'
|
3
|
+
require 'labimotion/version'
|
4
|
+
require 'sablon'
|
5
|
+
|
6
|
+
module Labimotion
|
7
|
+
class ExportElement
|
8
|
+
def initialize(current_user, element, export_format)
|
9
|
+
@current_user = current_user
|
10
|
+
@element = element
|
11
|
+
@properties = element.properties
|
12
|
+
@options = element.properties_release[Labimotion::Prop::SEL_OPTIONS]
|
13
|
+
@export_format = export_format
|
14
|
+
rescue StandardError => e
|
15
|
+
Labimotion.log_exception(e)
|
16
|
+
byebug
|
17
|
+
end
|
18
|
+
|
19
|
+
def build_layers
|
20
|
+
objs = []
|
21
|
+
@properties[Labimotion::Prop::LAYERS]&.keys&.sort_by { |key| @properties[Labimotion::Prop::LAYERS][key]['position'] }&.each do |key|
|
22
|
+
layer = @properties[Labimotion::Prop::LAYERS][key] || {}
|
23
|
+
|
24
|
+
## Build fields html
|
25
|
+
# field_objs = build_fields_html(layer) if layer[Labimotion::Prop::FIELDS]&.length&.positive?
|
26
|
+
# field_html = Sablon.content(:html, field_objs) if field_objs.present?
|
27
|
+
field_objs = build_fields(layer)
|
28
|
+
|
29
|
+
layer_info = {
|
30
|
+
label: layer['label'],
|
31
|
+
layer: layer['layer'],
|
32
|
+
cols: layer['cols'],
|
33
|
+
timeRecord: layer['timeRecord'],
|
34
|
+
fields: field_objs
|
35
|
+
}
|
36
|
+
objs.push(layer_info)
|
37
|
+
end
|
38
|
+
objs
|
39
|
+
rescue StandardError => e
|
40
|
+
Labimotion.log_exception(e)
|
41
|
+
byebug
|
42
|
+
end
|
43
|
+
|
44
|
+
def build_field(layer, field)
|
45
|
+
field_obj = {}
|
46
|
+
field_obj[:label] = field['label']
|
47
|
+
field_obj[:field] = field['field']
|
48
|
+
field_obj[:type] = field['type']
|
49
|
+
|
50
|
+
field_obj.merge!(field.slice('value', 'value_system'))
|
51
|
+
|
52
|
+
case field['type']
|
53
|
+
when Labimotion::FieldType::DRAG_ELEMENT
|
54
|
+
field_obj[:value] = (field['value'] && field['value']['el_label']) || ''
|
55
|
+
field_obj[:obj] = field['value'] ### change to object
|
56
|
+
when Labimotion::FieldType::DRAG_SAMPLE
|
57
|
+
val = field.fetch('value', {})
|
58
|
+
sample = Sample.find_by(id: val['el_id'])
|
59
|
+
field_obj[:value] = val['el_label']
|
60
|
+
field_obj[:has_structure] = true
|
61
|
+
obj_os = OpenStruct.new(sample)
|
62
|
+
field_obj[:structure] = Reporter::Docx::DiagramSample.new(obj: obj_os, format: 'png').generate
|
63
|
+
when Labimotion::FieldType::DRAG_MOLECULE
|
64
|
+
val = field.fetch('value', {})
|
65
|
+
obj = Molecule.find_by(id: val['el_id'])
|
66
|
+
field_obj[:value] = val['el_label']
|
67
|
+
# field_obj[:has_structure] = true
|
68
|
+
# field_obj[:structure] = Reporter::Docx::DiagramSample.new(obj: obj, format: 'png').generate
|
69
|
+
when Labimotion::FieldType::SELECT
|
70
|
+
field_obj[:value] = @options.fetch(field['option_layers'], nil)&.fetch('options', nil)&.find { |ss| ss['key'] == field['value'] }&.fetch('label', nil) || field['value']
|
71
|
+
when Labimotion::FieldType::UPLOAD
|
72
|
+
files = field.fetch('value', nil)&.fetch('files', [])
|
73
|
+
val = files&.map { |file| "#{file['filename']} #{file['label']}" }&.join('\n')
|
74
|
+
field_obj[:value] = val
|
75
|
+
when Labimotion::FieldType::TABLE
|
76
|
+
field_obj[:value] = 'this is a table' ## to be handled
|
77
|
+
when Labimotion::FieldType::INPUT_GROUP
|
78
|
+
field_obj[:value] = 'this is a input group' ## to be handled
|
79
|
+
end
|
80
|
+
field_obj
|
81
|
+
rescue StandardError => e
|
82
|
+
Labimotion.log_exception(e)
|
83
|
+
byebug
|
84
|
+
end
|
85
|
+
|
86
|
+
def build_fields(layer)
|
87
|
+
fields = layer[Labimotion::Prop::FIELDS] || []
|
88
|
+
field_objs = []
|
89
|
+
fields.each do |field|
|
90
|
+
field_obj = build_field(layer, field)
|
91
|
+
field_objs.push(field_obj)
|
92
|
+
end
|
93
|
+
field_objs
|
94
|
+
rescue StandardError => e
|
95
|
+
Labimotion.log_exception(e)
|
96
|
+
byebug
|
97
|
+
end
|
98
|
+
|
99
|
+
def to_docx
|
100
|
+
# location = Rails.root.join('lib', 'template', 'Labimotion.docx')
|
101
|
+
location = Rails.root.join('lib', 'template', 'Labimotion_lines.docx')
|
102
|
+
File.exist?(location)
|
103
|
+
template = Sablon.template(location)
|
104
|
+
layers = build_layers
|
105
|
+
context = {
|
106
|
+
name: @element.name,
|
107
|
+
short_label: @element.short_label,
|
108
|
+
date: Time.now.strftime('%d/%m/%Y'),
|
109
|
+
author: @current_user.name,
|
110
|
+
layers: layers
|
111
|
+
}
|
112
|
+
output = "Labimotion1.docx"
|
113
|
+
template.render_to_file File.expand_path(output), context
|
114
|
+
File.read(output)
|
115
|
+
rescue StandardError => e
|
116
|
+
Labimotion.log_exception(e)
|
117
|
+
byebug
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
def build_field_html(layer, field, cols)
|
122
|
+
case field['type']
|
123
|
+
when Labimotion::FieldType::DRAG_SAMPLE, Labimotion::FieldType::DRAG_ELEMENT, Labimotion::FieldType::DRAG_MOLECULE
|
124
|
+
val = (field['value'] && field['value']['el_label']) || ''
|
125
|
+
when Labimotion::FieldType::UPLOAD
|
126
|
+
val = (field['value'] && field['value']['files'] && field['value']['files'].first && field['value']['files'].first['filename'] ) || ''
|
127
|
+
else
|
128
|
+
val = field['value']
|
129
|
+
end
|
130
|
+
htd = field['hasOwnRow'] == true ? "<td colspan=#{cols}>" : '<td>'
|
131
|
+
"#{htd}<b>#{field['label']}: </b><br />#{val}</td>"
|
132
|
+
rescue StandardError => e
|
133
|
+
Labimotion.log_exception(e)
|
134
|
+
byebug
|
135
|
+
end
|
136
|
+
|
137
|
+
def build_fields_html(layer)
|
138
|
+
fields = layer[Labimotion::Prop::FIELDS] || []
|
139
|
+
field_objs = []
|
140
|
+
cols = layer['cols'] || 0
|
141
|
+
field_objs.push('<table style="width: 4000dxa"><tr>')
|
142
|
+
fields.each do |field|
|
143
|
+
if cols&.zero? || field['hasOwnRow'] == true
|
144
|
+
field_objs.push('</tr><tr>')
|
145
|
+
cols = layer['cols']
|
146
|
+
end
|
147
|
+
field_obj = build_field_html(layer, field, layer['cols'])
|
148
|
+
field_objs.push(field_obj)
|
149
|
+
cols -= 1
|
150
|
+
cols = 0 if field['hasOwnRow'] == true
|
151
|
+
end
|
152
|
+
field_objs.push('</tr></table>')
|
153
|
+
field_objs&.join("")&.gsub('<tr></tr>', '')
|
154
|
+
rescue StandardError => e
|
155
|
+
Labimotion.log_exception(e)
|
156
|
+
byebug
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
def build_layers_html
|
161
|
+
layer_html = []
|
162
|
+
first_line = true
|
163
|
+
@properties[Labimotion::Prop::LAYERS]&.keys&.each do |key|
|
164
|
+
layer_html.push('</tr></table>') if first_line == false
|
165
|
+
layer = @properties[Labimotion::Prop::LAYERS][key] || {}
|
166
|
+
fields = layer[Labimotion::Prop::FIELDS] || []
|
167
|
+
layer_html.push("<h2><b>Layer:#{layer['label']}</b></h2>")
|
168
|
+
layer_html.push('<table><tr>')
|
169
|
+
cols = layer['cols']
|
170
|
+
fields.each do |field|
|
171
|
+
if (cols === 0)
|
172
|
+
layer_html.push('</tr><tr>')
|
173
|
+
end
|
174
|
+
|
175
|
+
val = field['value'].is_a?(Hash) ? field['value']['el_label'] : field['value']
|
176
|
+
layer_html.push("<td>#{field['label']}: <br />#{val}</td>")
|
177
|
+
cols -= 1
|
178
|
+
end
|
179
|
+
first_line = false
|
180
|
+
end
|
181
|
+
layer_html.push('</tr></table>')
|
182
|
+
byebug
|
183
|
+
layer_html.join('')
|
184
|
+
rescue StandardError => e
|
185
|
+
Labimotion.log_exception(e)
|
186
|
+
byebug
|
187
|
+
end
|
188
|
+
|
189
|
+
def html_labimotion
|
190
|
+
layers_html = build_layers_html
|
191
|
+
html_body = <<-HTML.strip
|
192
|
+
#{layers_html}
|
193
|
+
HTML
|
194
|
+
html_body
|
195
|
+
rescue StandardError => e
|
196
|
+
Labimotion.log_exception(e)
|
197
|
+
byebug
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'export_table'
|
3
|
+
require 'labimotion/version'
|
4
|
+
require 'sablon'
|
5
|
+
|
6
|
+
module Labimotion
|
7
|
+
class ExportElementBak1
|
8
|
+
def initialize(current_user, element, export_format)
|
9
|
+
@current_user = current_user
|
10
|
+
@element = element
|
11
|
+
@properties = element.properties
|
12
|
+
@export_format = export_format
|
13
|
+
rescue StandardError => e
|
14
|
+
Labimotion.log_exception(e)
|
15
|
+
byebug
|
16
|
+
end
|
17
|
+
|
18
|
+
def build_field(layer, field)
|
19
|
+
field_obj = {}
|
20
|
+
field_obj[:label] = field['label']
|
21
|
+
field_obj[:field] = field['field']
|
22
|
+
field_obj[:type] = field['type']
|
23
|
+
|
24
|
+
case field['type']
|
25
|
+
when Labimotion::FieldType::DRAG_SAMPLE, Labimotion::FieldType::DRAG_ELEMENT, Labimotion::FieldType::DRAG_MOLECULE
|
26
|
+
field_obj[:value] = field['value']['el_label']
|
27
|
+
else
|
28
|
+
field_obj[:value] = field['value']
|
29
|
+
end
|
30
|
+
field_obj
|
31
|
+
rescue StandardError => e
|
32
|
+
Labimotion.log_exception(e)
|
33
|
+
byebug
|
34
|
+
end
|
35
|
+
|
36
|
+
def build_fields(layer, fields)
|
37
|
+
field_objs = []
|
38
|
+
fields.each do |field|
|
39
|
+
field_obj = build_field(layer, field)
|
40
|
+
field_objs.push(field_obj)
|
41
|
+
end
|
42
|
+
field_objs
|
43
|
+
rescue StandardError => e
|
44
|
+
Labimotion.log_exception(e)
|
45
|
+
byebug
|
46
|
+
end
|
47
|
+
def build_layers
|
48
|
+
objs = []
|
49
|
+
@properties[Labimotion::Prop::LAYERS]&.keys&.each do |key|
|
50
|
+
layer = @properties[Labimotion::Prop::LAYERS][key] || {}
|
51
|
+
fields = layer[Labimotion::Prop::FIELDS] || []
|
52
|
+
field_objs = build_fields(layer, fields)
|
53
|
+
|
54
|
+
layer_info = {
|
55
|
+
label: layer['label'],
|
56
|
+
layer: layer['layer'],
|
57
|
+
cols: layer['cols'],
|
58
|
+
fields: field_objs
|
59
|
+
}
|
60
|
+
objs.push(layer_info)
|
61
|
+
end
|
62
|
+
objs
|
63
|
+
rescue StandardError => e
|
64
|
+
Labimotion.log_exception(e)
|
65
|
+
byebug
|
66
|
+
end
|
67
|
+
|
68
|
+
def html_sample
|
69
|
+
html_body = <<-HTML.strip
|
70
|
+
<p style="text-align: right; background-color: #FFFF00">
|
71
|
+
Right aligned content with a yellow background color.
|
72
|
+
</p>
|
73
|
+
<div>
|
74
|
+
<span style="color: #123456">Inline styles</span> are possible as well
|
75
|
+
</div>
|
76
|
+
<table>
|
77
|
+
<tr>
|
78
|
+
<th>Company</th>
|
79
|
+
<th>Contact</th>
|
80
|
+
<th>Country</th>
|
81
|
+
</tr>
|
82
|
+
<tr>
|
83
|
+
<td>Alfreds Futterkiste</td>
|
84
|
+
<td>Maria Anders</td>
|
85
|
+
<td>Germany</td>
|
86
|
+
</tr>
|
87
|
+
</table>
|
88
|
+
|
89
|
+
HTML
|
90
|
+
html_body
|
91
|
+
rescue StandardError => e
|
92
|
+
Labimotion.log_exception(e)
|
93
|
+
byebug
|
94
|
+
end
|
95
|
+
|
96
|
+
def to_docx
|
97
|
+
location = Rails.root.join('lib', 'template', 'Labimotion.docx')
|
98
|
+
File.exist?(location)
|
99
|
+
template = Sablon.template(location)
|
100
|
+
layers = build_layers
|
101
|
+
byebug
|
102
|
+
html_body = html_sample
|
103
|
+
html_content = Sablon.content(:html, html_body)
|
104
|
+
context = {
|
105
|
+
name: @element.name,
|
106
|
+
short_label: @element.short_label,
|
107
|
+
layers: layers,
|
108
|
+
html_sample: html_content
|
109
|
+
}
|
110
|
+
output = "Labimotion1.docx"
|
111
|
+
template.render_to_file File.expand_path(output), context
|
112
|
+
File.read(output)
|
113
|
+
rescue StandardError => e
|
114
|
+
Labimotion.log_exception(e)
|
115
|
+
byebug
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -36,7 +36,7 @@ module Labimotion
|
|
36
36
|
value
|
37
37
|
end
|
38
38
|
|
39
|
-
def proc_assign_sample(value, sample
|
39
|
+
def proc_assign_sample(value, sample)
|
40
40
|
return {} if sample.nil?
|
41
41
|
|
42
42
|
value = {} if value.nil? || value.is_a?(String)
|
@@ -45,16 +45,13 @@ module Labimotion
|
|
45
45
|
value['el_tip'] = sample.short_label
|
46
46
|
value['el_label'] = sample.short_label
|
47
47
|
value['el_svg'] = sample.get_svg_path
|
48
|
-
if element&.class&.name == Labimotion::Prop::L_ELEMENT && sample&.class&.name == Labimotion::Prop::SAMPLE
|
49
|
-
Labimotion::ElementsSample.find_or_create_by(element_id: element.id, sample_id: sample.id)
|
50
|
-
end
|
51
48
|
value
|
52
49
|
rescue StandardError => e
|
53
50
|
Labimotion.log_exception(e)
|
54
51
|
value
|
55
52
|
end
|
56
53
|
|
57
|
-
def proc_assign_element(value, element
|
54
|
+
def proc_assign_element(value, element)
|
58
55
|
return {} if element.nil?
|
59
56
|
|
60
57
|
value = {} if value.nil? || value.is_a?(String)
|
@@ -62,9 +59,6 @@ module Labimotion
|
|
62
59
|
value['el_type'] = 'element' if value['el_type'].nil?
|
63
60
|
value['el_tip'] = element.short_label
|
64
61
|
value['el_label'] = element.short_label
|
65
|
-
if _parent&.class&.name == Labimotion::Prop::L_ELEMENT && element&.class&.name == Labimotion::Prop::L_ELEMENT
|
66
|
-
Labimotion::ElementsElement.find_or_create_by(parent_id: _parent.id, element_id: element.id)
|
67
|
-
end
|
68
62
|
value
|
69
63
|
rescue StandardError => e
|
70
64
|
Labimotion.log_exception(e)
|
@@ -98,20 +92,20 @@ module Labimotion
|
|
98
92
|
properties
|
99
93
|
end
|
100
94
|
|
101
|
-
def proc_table_sample(properties, data, instances, svalue, key, tidx, vdx, col_id
|
95
|
+
def proc_table_sample(properties, data, instances, svalue, key, tidx, vdx, col_id)
|
102
96
|
return properties unless id = svalue.fetch('el_id', nil)
|
103
97
|
|
104
98
|
# orig_s = data.fetch(Labimotion::Prop::SAMPLE, nil)&.fetch(svalue['el_id'], nil)
|
105
99
|
sample = instances.fetch(Labimotion::Prop::SAMPLE, nil)&.fetch(id, nil)
|
106
100
|
val = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][tidx]['sub_values'][vdx][col_id]['value']
|
107
|
-
properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][tidx]['sub_values'][vdx][col_id]['value'] = proc_assign_sample(val, sample
|
101
|
+
properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][tidx]['sub_values'][vdx][col_id]['value'] = proc_assign_sample(val, sample)
|
108
102
|
properties
|
109
103
|
rescue StandardError => e
|
110
104
|
Labimotion.log_exception(e)
|
111
105
|
properties
|
112
106
|
end
|
113
107
|
|
114
|
-
def proc_table_prop(layer, key, data, instance, properties, field, tidx, type
|
108
|
+
def proc_table_prop(layer, key, data, instance, properties, field, tidx, type)
|
115
109
|
fields = field[Labimotion::Prop::SUBFIELDS].select { |ss| ss['type'] == type }
|
116
110
|
return properties if fields.nil?
|
117
111
|
|
@@ -131,7 +125,7 @@ module Labimotion
|
|
131
125
|
when Labimotion::FieldType::DRAG_MOLECULE
|
132
126
|
properties = proc_table_molecule(properties, data, svalue, key, tidx, vdx, col_id)
|
133
127
|
when Labimotion::FieldType::DRAG_SAMPLE
|
134
|
-
properties = proc_table_sample(properties, data, instance, svalue, key, tidx, vdx, col_id
|
128
|
+
properties = proc_table_sample(properties, data, instance, svalue, key, tidx, vdx, col_id)
|
135
129
|
end
|
136
130
|
end
|
137
131
|
end
|
@@ -142,14 +136,14 @@ module Labimotion
|
|
142
136
|
end
|
143
137
|
end
|
144
138
|
|
145
|
-
def self.proc_sample(layer, key, data, instances, properties
|
139
|
+
def self.proc_sample(layer, key, data, instances, properties)
|
146
140
|
fields = layer[Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::DRAG_SAMPLE }
|
147
141
|
fields.each do |field|
|
148
142
|
idx = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
149
143
|
id = field["value"] && field["value"]["el_id"] unless idx.nil?
|
150
144
|
sample = instances.fetch(Labimotion::Prop::SAMPLE, nil)&.fetch(id, nil)
|
151
145
|
val = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']
|
152
|
-
val = proc_assign_sample(val, sample
|
146
|
+
val = proc_assign_sample(val, sample)
|
153
147
|
properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value'] = val
|
154
148
|
end
|
155
149
|
properties
|
@@ -158,7 +152,7 @@ module Labimotion
|
|
158
152
|
raise
|
159
153
|
end
|
160
154
|
|
161
|
-
def self.proc_element(layer, key, data, instances, properties, elements
|
155
|
+
def self.proc_element(layer, key, data, instances, properties, elements)
|
162
156
|
fields = layer[Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::DRAG_ELEMENT }
|
163
157
|
fields.each do |field|
|
164
158
|
idx = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
@@ -168,7 +162,7 @@ module Labimotion
|
|
168
162
|
properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value'] = {}
|
169
163
|
else
|
170
164
|
val = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']
|
171
|
-
val = proc_assign_element(val, att_el
|
165
|
+
val = proc_assign_element(val, att_el)
|
172
166
|
properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value'] = val
|
173
167
|
end
|
174
168
|
end
|
@@ -231,14 +225,14 @@ module Labimotion
|
|
231
225
|
end
|
232
226
|
|
233
227
|
|
234
|
-
def self.proc_table(layer, key, data, instance, properties
|
228
|
+
def self.proc_table(layer, key, data, instance, properties)
|
235
229
|
fields = layer[Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::TABLE }
|
236
230
|
fields&.each do |field|
|
237
231
|
tidx = layer[Labimotion::Prop::FIELDS].index(field)
|
238
232
|
next unless field['sub_values'].present? && field[Labimotion::Prop::SUBFIELDS].present?
|
239
233
|
|
240
|
-
proc_table_prop(layer, key, data, instance, properties, field, tidx, Labimotion::FieldType::DRAG_MOLECULE
|
241
|
-
proc_table_prop(layer, key, data, instance, properties, field, tidx, Labimotion::FieldType::DRAG_SAMPLE
|
234
|
+
proc_table_prop(layer, key, data, instance, properties, field, tidx, Labimotion::FieldType::DRAG_MOLECULE)
|
235
|
+
proc_table_prop(layer, key, data, instance, properties, field, tidx, Labimotion::FieldType::DRAG_SAMPLE)
|
242
236
|
end
|
243
237
|
properties
|
244
238
|
rescue StandardError => e
|
@@ -252,9 +246,9 @@ module Labimotion
|
|
252
246
|
layer = properties[Labimotion::Prop::LAYERS][key]
|
253
247
|
properties = proc_molecule(layer, key, data, properties)
|
254
248
|
properties = proc_upload(layer, key, data, instances, attachments, elmenet)
|
255
|
-
properties = proc_sample(layer, key, data, instances, properties
|
256
|
-
properties = proc_element(layer, key, data, instances, properties, elements
|
257
|
-
properties = proc_table(layer, key, data, instances, properties
|
249
|
+
properties = proc_sample(layer, key, data, instances, properties)
|
250
|
+
properties = proc_element(layer, key, data, instances, properties, elements) # unless elements.nil?
|
251
|
+
properties = proc_table(layer, key, data, instances, properties)
|
258
252
|
end
|
259
253
|
properties
|
260
254
|
rescue StandardError => e
|
data/lib/labimotion/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: labimotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chia-Lin Lin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-03-
|
12
|
+
date: 2024-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -66,6 +66,8 @@ files:
|
|
66
66
|
- lib/labimotion/helpers/segment_helpers.rb
|
67
67
|
- lib/labimotion/libs/converter.rb
|
68
68
|
- lib/labimotion/libs/export_dataset.rb
|
69
|
+
- lib/labimotion/libs/export_element1.rb
|
70
|
+
- lib/labimotion/libs/export_element_bak1.rb
|
69
71
|
- lib/labimotion/libs/nmr_mapper.rb
|
70
72
|
- lib/labimotion/libs/properties_handler.rb
|
71
73
|
- lib/labimotion/libs/sample_association.rb
|
@@ -102,7 +104,7 @@ files:
|
|
102
104
|
- lib/labimotion/utils/serializer.rb
|
103
105
|
- lib/labimotion/utils/utils.rb
|
104
106
|
- lib/labimotion/version.rb
|
105
|
-
homepage: https://
|
107
|
+
homepage: https://github.com/LabIMotion/labimotion
|
106
108
|
licenses:
|
107
109
|
- AGPL-3.0
|
108
110
|
metadata: {}
|
@@ -117,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
119
|
version: '0'
|
118
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
121
|
requirements:
|
120
|
-
- - "
|
122
|
+
- - ">"
|
121
123
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
124
|
+
version: 1.3.1
|
123
125
|
requirements: []
|
124
126
|
rubygems_version: 3.1.6
|
125
127
|
signing_key:
|