labimotion 1.5.0.rc8 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a54a18e3c64bb9446ecf6c57aa2755d9ab0921a2571aa734615faa40f46d19d
4
- data.tar.gz: 03a66fbf2e025ac855831349888ab941b7a2059a02557c473c4654eaceb62601
3
+ metadata.gz: 9ba4a246b95d088b7928826074a223b671bd3ff8ac7c4bce5904ff983aec1534
4
+ data.tar.gz: c1393205315928947b688566db60ac311eef1fcfccedbb395e521a2dbdfdfbdd
5
5
  SHA512:
6
- metadata.gz: fb9af61e157bc3c89b8b32d3fe51aa580d6a684c8348029e6b291e65d0f1876f48279f09bd291dc40194cb2a1c84cc84c6ea3beac5092f34ce1b2d6fd64db52b
7
- data.tar.gz: cde31727f46f71e4803cc933f56e1f73785f87f9ab928a010299dc7c33dbdd504907cc31aa73bdc81000bf1774a60095a23860ae4e7d6b0ffdd29046612615da
6
+ metadata.gz: fbf716f60ca698f40f332b318d55747266d23ffa0c066f2afb5eff44f90c54db1402d8b42e251641fa1564aff167c79abe86411c519653c59ffbca36991a85fd
7
+ data.tar.gz: 4dbeae09a3740df12533e217e11d4fbc003894280ccc9d6f46e2042cf4b0ff4b2ce448215a9d918e38b077458caba39e26c55a31870b9e9e7f753f8d25bfc41b
@@ -21,7 +21,7 @@ module Labimotion
21
21
  process_sample_and_molecule_fields(key, layer)
22
22
  process_reaction_fields(key, layer)
23
23
  process_table_fields(key, layer)
24
- process_voc_fields(key, layer)
24
+ # process_voc_fields(key, layer)
25
25
  end
26
26
 
27
27
  def process_sample_and_molecule_fields(key, layer)
@@ -52,7 +52,7 @@ module Labimotion
52
52
  fields = layer[Labimotion::Prop::FIELDS]
53
53
  fields = fields.select { |f| types.include?(f['type']) } if types
54
54
  fields = fields.select { |f| f['is_voc'] == true } if is_voc
55
- fields.map { |f| [f, fields.index(f)] }
55
+ fields.map { |f| [f, layer[Labimotion::Prop::FIELDS].index(f)] }
56
56
  end
57
57
 
58
58
  def update_sample_or_molecule_field(key, field, idx)
@@ -100,7 +100,6 @@ module Labimotion
100
100
 
101
101
  def update_voc_field(key, field, idx)
102
102
  root_element = get_root_element
103
-
104
103
  case field['source']
105
104
  when Labimotion::Prop::ELEMENT
106
105
  update_element_voc_field(key, field, idx, root_element)
@@ -113,7 +113,6 @@ module Labimotion
113
113
  params.delete(:properties)
114
114
  update_element_labels(element, params[:user_labels], current_user.id)
115
115
  params.delete(:user_labels)
116
-
117
116
  attributes = declared(params.except(:segments), include_missing: false)
118
117
  properties['pkg'] = Labimotion::Utils.pkg(properties['pkg'])
119
118
  if element.klass_uuid != properties['klass_uuid'] || element.properties != properties || element.name != params[:name]
@@ -124,15 +123,16 @@ module Labimotion
124
123
  properties.delete('flow') unless properties['flow'].nil?
125
124
  properties.delete('flowObject') unless properties['flowObject'].nil?
126
125
  properties.delete('select_options') unless properties['select_options'].nil?
127
-
128
126
  attributes['properties'] = properties
129
127
  attributes['properties']['uuid'] = uuid
130
128
  attributes['uuid'] = uuid
131
129
  attributes['klass_uuid'] = properties['klass_uuid']
132
-
133
130
  element.update(attributes)
134
131
  end
135
132
  element.save_segments(segments: params[:segments], current_user_id: current_user.id)
133
+ element.reload
134
+ element.properties = update_vocabularies(element.properties, current_user, element)
135
+ element.save!
136
136
  element
137
137
  rescue StandardError => e
138
138
  Labimotion.log_exception(e, current_user)
@@ -72,7 +72,7 @@ module Labimotion
72
72
  # el_attributes['properties_template'] = response['element_klass']['properties_release']
73
73
  # Labimotion::ElementKlass.create!(el_attributes)
74
74
  attributes['element_klass_id'] = element_klass.id
75
- segment_klass = Labimotion::SegmentKlass.find_by(identifier: attributes['identifier'])
75
+ segment_klass = Labimotion::SegmentKlass.find_by(identifier: attributes['identifier']) if attributes['identifier'].present?
76
76
  if segment_klass.present?
77
77
  if segment_klass['uuid'] == attributes['uuid'] && segment_klass['version'] == attributes['version']
78
78
  return { status: 'success', message: "This segment: #{attributes['label']} has the latest version!" }
@@ -1,12 +1,298 @@
1
1
  [
2
2
  {
3
- "id": 9,
4
- "identifier": "solvent",
5
- "name": "Solvent",
3
+ "identifier": "std-atmosphere",
4
+ "name": "atmosphere",
5
+ "label": "Atmosphere",
6
+ "field_type": "text",
7
+ "ontology": {
8
+ "id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C54711",
9
+ "iri": "http://purl.obolibrary.org/obo/NCIT_C54711",
10
+ "short_form": "NCIT_C54711",
11
+ "obo_id": "NCIT:C54711",
12
+ "label": "Atmosphere",
13
+ "description": [
14
+ "Non-SI unit of pressure equal to 101 325 Pa."
15
+ ],
16
+ "ontology_name": "ncit",
17
+ "ontology_prefix": "NCIT",
18
+ "type": "class"
19
+ },
20
+ "source": "Standard"
21
+ },
22
+ {
23
+ "identifier": "std-calibration",
24
+ "name": "calibration",
25
+ "label": "Calibration",
26
+ "field_type": "text",
27
+ "ontology": {
28
+ "id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C69187",
29
+ "iri": "http://purl.obolibrary.org/obo/NCIT_C69187",
30
+ "short_form": "NCIT_C69187",
31
+ "obo_id": "NCIT:C69187",
32
+ "label": "Calibration",
33
+ "description": [
34
+ "The act of checking or adjusting (by comparison with a standard) the accuracy of a measuring instrument."
35
+ ],
36
+ "ontology_name": "ncit",
37
+ "ontology_prefix": "NCIT",
38
+ "type": "class"
39
+ },
40
+ "source": "Standard"
41
+ },
42
+ {
43
+ "identifier": "std-coating",
44
+ "name": "coating",
45
+ "label": "Coating",
46
+ "field_type": "text",
47
+ "ontology": {
48
+ "id": "afo:class:http://purl.allotrope.org/ontologies/process#AFP_0001986",
49
+ "iri": "http://purl.allotrope.org/ontologies/process#AFP_0001986",
50
+ "short_form": "AFP_0001986",
51
+ "obo_id": "AFP:0001986",
52
+ "label": "coating",
53
+ "description": [
54
+ "The application of a thin cover to a material. [CHMO]"
55
+ ],
56
+ "ontology_name": "afo",
57
+ "ontology_prefix": "AFO",
58
+ "type": "class"
59
+ },
60
+ "source": "Standard"
61
+ },
62
+ {
63
+ "identifier": "std-coating_material",
64
+ "name": "coating_material",
65
+ "label": "Coating Material",
66
+ "field_type": "text",
67
+ "ontology": {
68
+ "id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C172794",
69
+ "iri": "http://purl.obolibrary.org/obo/NCIT_C172794",
70
+ "short_form": "NCIT_C172794",
71
+ "obo_id": "NCIT:C172794",
72
+ "label": "Coating Material",
73
+ "description": [
74
+ "A layer of material covering the surface of a device."
75
+ ],
76
+ "ontology_name": "ncit",
77
+ "ontology_prefix": "NCIT",
78
+ "type": "class"
79
+ },
80
+ "source": "Standard"
81
+ },
82
+ {
83
+ "identifier": "std-wavelength",
84
+ "name": "wavelength",
85
+ "label": "Wavelength",
86
+ "field_type": "text",
87
+ "ontology": {
88
+ "id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C48158",
89
+ "iri": "http://purl.obolibrary.org/obo/NCIT_C48158",
90
+ "short_form": "NCIT_C48158",
91
+ "obo_id": "NCIT:C48158",
92
+ "label": "Wavelength",
93
+ "description": [
94
+ "The distance (measured in the direction of propagation) between two points in the same phase in consecutive cycles of a wave."
95
+ ],
96
+ "ontology_name": "ncit",
97
+ "ontology_prefix": "NCIT",
98
+ "type": "class"
99
+ },
100
+ "source": "Standard"
101
+ },
102
+ {
103
+ "identifier": "std-sample_size",
104
+ "name": "sample_size",
105
+ "label": "Sample Size",
106
+ "field_type": "text",
107
+ "ontology": {
108
+ "id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C53190",
109
+ "iri": "http://purl.obolibrary.org/obo/NCIT_C53190",
110
+ "short_form": "NCIT_C53190",
111
+ "obo_id": "NCIT:C53190",
112
+ "label": "Sample Size",
113
+ "ontology_name": "ncit",
114
+ "ontology_prefix": "NCIT",
115
+ "type": "class"
116
+ },
117
+ "source": "Standard"
118
+ },
119
+ {
120
+ "identifier": "std-instrument",
121
+ "name": "instrument",
122
+ "label": "Instrument",
123
+ "field_type": "text",
124
+ "ontology": {
125
+ "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000463",
126
+ "iri": "http://nmrML.org/nmrCV#NMR:1000463",
127
+ "short_form": "NMR:1000463",
128
+ "label": "instrument",
129
+ "description": [
130
+ "Description of the instrument or the mass spectrometer."
131
+ ],
132
+ "ontology_name": "nmrcv",
133
+ "ontology_prefix": "NMRCV",
134
+ "type": "class"
135
+ },
136
+ "source": "Standard"
137
+ },
138
+ {
139
+ "identifier": "std-irr_freq",
140
+ "name": "irr_freq",
141
+ "label": "Irradiation frequency",
142
+ "field_type": "text",
143
+ "ontology": {
144
+ "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000463",
145
+ "iri": "http://nmrML.org/nmrCV#NMR:1000463",
146
+ "short_form": "NMR:1000463",
147
+ "label": "instrument",
148
+ "description": [
149
+ "Description of the instrument or the mass spectrometer."
150
+ ],
151
+ "ontology_name": "nmrcv",
152
+ "ontology_prefix": "NMRCV",
153
+ "type": "class"
154
+ },
155
+ "source": "Standard"
156
+ },
157
+ {
158
+ "identifier": "std-num_scans",
159
+ "name": "num_scans",
160
+ "label": "Number of scans",
161
+ "field_type": "text",
162
+ "ontology": {
163
+ "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1400087",
164
+ "iri": "http://nmrML.org/nmrCV#NMR:1400087",
165
+ "short_form": "NMR:1400087",
166
+ "label": "number of scans",
167
+ "description": [
168
+ "def: The number of repeat scans performed and summed to create the data set for an NMR sample."
169
+ ],
170
+ "ontology_name": "nmrcv",
171
+ "ontology_prefix": "NMRCV",
172
+ "type": "class"
173
+ },
174
+ "source": "Standard"
175
+ },
176
+ {
177
+ "identifier": "std-sample_ph",
178
+ "name": "sample_ph",
179
+ "label": "Sample pH",
180
+ "field_type": "text",
181
+ "ontology": {
182
+ "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000019",
183
+ "iri": "http://nmrML.org/nmrCV#NMR:1000019",
184
+ "short_form": "NMR:1000019",
185
+ "label": "sample pH",
186
+ "ontology_name": "nmrcv",
187
+ "ontology_prefix": "NMRCV",
188
+ "type": "class"
189
+ },
190
+ "source": "Standard"
191
+ },
192
+ {
193
+ "identifier": "std-pulse_seq",
194
+ "name": "pulse_seq",
195
+ "label": "NMR pulse sequence",
196
+ "field_type": "text",
197
+ "ontology": {
198
+ "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1400037",
199
+ "iri": "http://nmrML.org/nmrCV#NMR:1400037",
200
+ "short_form": "NMR:1400037",
201
+ "label": "NMR pulse sequence",
202
+ "description": [
203
+ "def: A sequence of excitation pulses.",
204
+ "http://www.bmrb.wisc.edu/tools/choose_pulse_info.php"
205
+ ],
206
+ "ontology_name": "nmrcv",
207
+ "ontology_prefix": "NMRCV",
208
+ "type": "class"
209
+ },
210
+ "source": "Standard"
211
+ },
212
+ {
213
+ "identifier": "std-sample_conc",
214
+ "name": "sample_conc",
215
+ "label": "sample concentration",
216
+ "field_type": "text",
217
+ "ontology": {
218
+ "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000006",
219
+ "iri": "http://nmrML.org/nmrCV#NMR:1000006",
220
+ "short_form": "NMR:1000006",
221
+ "label": "sample concentration",
222
+ "description": [
223
+ "Concentration of sample in picomol/ul, femtomol/ul or attomol/ul solution used."
224
+ ],
225
+ "ontology_name": "nmrcv",
226
+ "ontology_prefix": "NMRCV",
227
+ "type": "class"
228
+ },
229
+ "source": "Standard"
230
+ },
231
+ {
232
+ "identifier": "std-scan_range",
233
+ "name": "scan_range",
234
+ "label": "scan range",
235
+ "field_type": "text",
236
+ "ontology": {
237
+ "id": "afo:class:http://purl.allotrope.org/ontologies/result#AFR_0001957",
238
+ "iri": "http://purl.allotrope.org/ontologies/result#AFR_0001957",
239
+ "short_form": "AFR_0001957",
240
+ "obo_id": "AFR:0001957",
241
+ "label": "detector scan rate setting",
242
+ "description": [
243
+ "A detector setting that sets the frequency of scans per time unit. [Allotrope]"
244
+ ],
245
+ "ontology_name": "afo",
246
+ "ontology_prefix": "AFO",
247
+ "type": "class"
248
+ },
249
+ "source": "Standard"
250
+ },
251
+ {
252
+ "identifier": "std-software_name",
253
+ "name": "software_name",
254
+ "label": "Software Name",
255
+ "field_type": "text",
256
+ "ontology": {
257
+ "id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C150832",
258
+ "iri": "http://purl.obolibrary.org/obo/NCIT_C150832",
259
+ "short_form": "NCIT_C150832",
260
+ "obo_id": "NCIT:C150832",
261
+ "label": "Software Name",
262
+ "description": [
263
+ "The literal identifier of the software program."
264
+ ],
265
+ "ontology_name": "ncit",
266
+ "ontology_prefix": "NCIT",
267
+ "type": "class"
268
+ },
269
+ "source": "Standard"
270
+ },
271
+ {
272
+ "identifier": "std-software_ver",
273
+ "name": "software_ver",
274
+ "label": "Software Version",
275
+ "field_type": "text",
276
+ "ontology": {
277
+ "id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C111093",
278
+ "iri": "http://purl.obolibrary.org/obo/NCIT_C111093",
279
+ "short_form": "NCIT_C111093",
280
+ "obo_id": "NCIT:C111093",
281
+ "label": "Software Version",
282
+ "description": [
283
+ "A form or variant of software; one of a sequence of copies of a software program, each incorporating new modifications."
284
+ ],
285
+ "ontology_name": "ncit",
286
+ "ontology_prefix": "NCIT",
287
+ "type": "class"
288
+ },
289
+ "source": "Standard"
290
+ },
291
+ {
292
+ "identifier": "std-solvent",
293
+ "name": "nmr_solvent",
6
294
  "label": "NMR Solvent",
7
295
  "field_type": "text",
8
- "opid": 0,
9
- "term_id": "NMR:1000330",
10
296
  "ontology": {
11
297
  "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000330",
12
298
  "iri": "http://nmrML.org/nmrCV#NMR:1000330",
@@ -22,25 +308,78 @@
22
308
  "source": "Standard"
23
309
  },
24
310
  {
25
- "id": 11,
26
- "identifier": "temperature",
27
- "name": "Temperature",
28
- "label": "Temperature",
29
- "field_type": "text",
30
- "opid": 0,
31
- "term_id": "NMR:1400025",
32
- "ontology": {
33
- "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1400025",
34
- "iri": "http://nmrML.org/nmrCV#NMR:1400025",
35
- "short_form": "NMR:1400025",
36
- "label": "sample temperature in magnet",
37
- "description": [
38
- "def: The temperature of an NMR sample whilst in the magnet of an NMR instrument."
39
- ],
40
- "ontology_name": "nmrcv",
41
- "ontology_prefix": "NMRCV",
42
- "type": "class"
43
- },
44
- "source": "Standard"
311
+ "identifier": "std-sample_volume",
312
+ "name": "sample_volume",
313
+ "label": "sample volume",
314
+ "field_type": "text",
315
+ "ontology": {
316
+ "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000005",
317
+ "iri": "http://nmrML.org/nmrCV#NMR:1000005",
318
+ "short_form": "NMR:1000005",
319
+ "label": "sample volume",
320
+ "description": [
321
+ "Total volume of solution used."
322
+ ],
323
+ "ontology_name": "nmrcv",
324
+ "ontology_prefix": "NMRCV",
325
+ "type": "class"
326
+ },
327
+ "source": "Standard"
328
+ },
329
+ {
330
+ "identifier": "std-solvent_info",
331
+ "name": "solvent_info",
332
+ "label": "NMR solvent information",
333
+ "field_type": "text",
334
+ "ontology": {
335
+ "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1002010",
336
+ "iri": "http://nmrML.org/nmrCV#NMR:1002010",
337
+ "short_form": "NMR:1002010",
338
+ "label": "NMR solvent information",
339
+ "ontology_name": "nmrcv",
340
+ "ontology_prefix": "NMRCV",
341
+ "type": "class"
342
+ },
343
+ "source": "Standard"
344
+ },
345
+ {
346
+ "identifier": "std-sample_tube",
347
+ "name": "sample_tube",
348
+ "label": "NMR sample tube",
349
+ "field_type": "text",
350
+ "ontology": {
351
+ "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1400132",
352
+ "iri": "http://nmrML.org/nmrCV#NMR:1400132",
353
+ "short_form": "NMR:1400132",
354
+ "label": "NMR sample tube",
355
+ "description": [
356
+ "http://en.wikipedia.org/wiki/NMR_tube",
357
+ "sortal dimensions are Vendor, Size (Diameter, length), Material (glass, quarz, pyrex ...), Frequency, Concentricity, OD and ID",
358
+ "The sample-tube holds the NMR sample and sits in the NMR probe. It is usually a glass tube of 5-20mm diameter."
359
+ ],
360
+ "ontology_name": "nmrcv",
361
+ "ontology_prefix": "NMRCV",
362
+ "type": "class"
363
+ },
364
+ "source": "Standard"
365
+ },
366
+ {
367
+ "identifier": "temperature",
368
+ "name": "Temperature",
369
+ "label": "Temperature",
370
+ "field_type": "text",
371
+ "ontology": {
372
+ "id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1400025",
373
+ "iri": "http://nmrML.org/nmrCV#NMR:1400025",
374
+ "short_form": "NMR:1400025",
375
+ "label": "sample temperature in magnet",
376
+ "description": [
377
+ "def: The temperature of an NMR sample whilst in the magnet of an NMR instrument."
378
+ ],
379
+ "ontology_name": "nmrcv",
380
+ "ontology_prefix": "NMRCV",
381
+ "type": "class"
382
+ },
383
+ "source": "Standard"
45
384
  }
46
385
  ]
@@ -1,8 +1,8 @@
1
1
  [
2
2
  {
3
3
  "id": 1,
4
- "identifier": "dateTime.create",
5
- "name": "Create Time",
4
+ "identifier": "dateTime-create",
5
+ "name": "create_time",
6
6
  "label": "Create Time",
7
7
  "field_type": "datetime",
8
8
  "opid": 9,
@@ -27,8 +27,8 @@
27
27
  },
28
28
  {
29
29
  "id": 2,
30
- "identifier": "dateTime.update",
31
- "name": "Update Time",
30
+ "identifier": "dateTime-update",
31
+ "name": "update_time",
32
32
  "label": "Update Time",
33
33
  "field_type": "datetime",
34
34
  "opid": 9,
@@ -53,7 +53,7 @@
53
53
  },
54
54
  {
55
55
  "id": 4,
56
- "identifier": "user.name",
56
+ "identifier": "user-name",
57
57
  "name": "creator",
58
58
  "label": "creator",
59
59
  "field_type": "text",
@@ -79,8 +79,8 @@
79
79
  },
80
80
  {
81
81
  "id": 2,
82
- "identifier": "element.id",
83
- "name": "Element Id",
82
+ "identifier": "element-id",
83
+ "name": "element_id",
84
84
  "label": "Element Id",
85
85
  "field_type": "text",
86
86
  "opid": 9,
@@ -92,8 +92,8 @@
92
92
  },
93
93
  {
94
94
  "id": 5,
95
- "identifier": "element.name",
96
- "name": "Element Name",
95
+ "identifier": "element-name",
96
+ "name": "element_name",
97
97
  "label": "Element Name",
98
98
  "field_type": "text",
99
99
  "opid": 8,
@@ -105,8 +105,8 @@
105
105
  },
106
106
  {
107
107
  "id": 3,
108
- "identifier": "element.short_label",
109
- "name": "Element Short Label",
108
+ "identifier": "element-short_label",
109
+ "name": "element_short_label",
110
110
  "label": "Element Short Label",
111
111
  "field_type": "text",
112
112
  "opid": 9,
@@ -118,8 +118,8 @@
118
118
  },
119
119
  {
120
120
  "id": 3,
121
- "identifier": "element.class",
122
- "name": "Element Class",
121
+ "identifier": "element-class",
122
+ "name": "element_class",
123
123
  "label": "Element Class",
124
124
  "field_type": "text",
125
125
  "opid": 9,
@@ -78,6 +78,8 @@ module Labimotion
78
78
  field_samples = layer[Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::DRAG_SAMPLE }
79
79
  field_samples.each do |field|
80
80
  idx = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
81
+ return if field.is_a?(String) || properties.is_a?(String)
82
+
81
83
  sid = field.dig('value', 'el_id')
82
84
  next if sid.blank?
83
85
 
@@ -100,6 +102,8 @@ module Labimotion
100
102
  field_elements = layer[Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::DRAG_ELEMENT }
101
103
  field_elements.each do |field|
102
104
  idx = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
105
+ next if field['value'].is_a?(String)
106
+
103
107
  sid = field.dig('value', 'el_id')
104
108
  next if element.nil? || sid.blank? || sid == element.id
105
109
 
@@ -24,7 +24,7 @@ module Labimotion
24
24
  private
25
25
 
26
26
  def update_layer_vocabularies(layer, key, properties, current_user, element)
27
- field_vocabularies = layer[Labimotion::Prop::FIELDS].select { |field| field['is_voc'] && field['opid'] == 9 }
27
+ field_vocabularies = layer[Labimotion::Prop::FIELDS].select { |field| field['is_voc'] }
28
28
  field_vocabularies.each do |field|
29
29
  idx = layer[Labimotion::Prop::FIELDS].index(field)
30
30
  val = get_vocabulary_value(field, current_user, element)
@@ -51,29 +51,34 @@ module Labimotion
51
51
  def get_system_value(field)
52
52
  current_time = Time.now.strftime('%d/%m/%Y %H:%M')
53
53
  case field['identifier']
54
- when 'dateTime.update'
54
+ when 'dateTime-update'
55
55
  current_time
56
- when 'dateTime.create'
56
+ when 'dateTime-create'
57
57
  current_time if field['value'].blank?
58
58
  end
59
59
  end
60
60
 
61
61
  def get_user_value(field, current_user)
62
- return current_user.name if field['identifier'] == 'user.name' && current_user.present?
62
+ current_user.name if field['identifier'] == 'user-name' && current_user.present?
63
63
  end
64
64
 
65
65
  def get_element_value(field, element)
66
66
  case field['identifier']
67
- when 'element.id'
67
+ when 'element-id'
68
68
  element.id.to_s
69
- when 'element.short_label'
69
+ when 'element-short_label'
70
70
  element.short_label if element.has_attribute?(:short_label)
71
- when 'element.class'
72
- if element.class.name === 'Labimotion::Element'
73
- element.element_klass.label
74
- else
75
- element.class.name
76
- end
71
+ when 'element-name'
72
+ element.name if element.has_attribute?(:name)
73
+ when 'element-class'
74
+ element.class.name === 'Labimotion::Element' ? element.element_klass.label : element.class.name
75
+ else
76
+ ek = element.element_klass
77
+ return if ek.nil? || ek.identifier != field['source_id']
78
+
79
+ el_prop = element.properties
80
+ fields = el_prop[Labimotion::Prop::LAYERS][field['layer_id']][Labimotion::Prop::FIELDS]
81
+ fields.find { |ss| ss['field'] == field['field_id'] }&.dig('value')
77
82
  end
78
83
  end
79
84
 
@@ -88,6 +93,7 @@ module Labimotion
88
93
 
89
94
  def update_field_value(properties, key, idx, val)
90
95
  properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value'] = val
96
+ properties
91
97
  end
92
98
 
93
99
  def load_from_files
@@ -3,7 +3,7 @@
3
3
  module Labimotion
4
4
  class StdLayer < ApplicationRecord
5
5
  acts_as_paranoid
6
- self.table_name = :l_s_lyrs
7
- has_many :l_s_lyrs_tracks, primary_key: 'identifier', foreign_key: 'identifier', class_name: 'Labimotion::StdLayersRevision'
6
+ self.table_name = :layers
7
+ has_many :layer_tracks, primary_key: 'identifier', foreign_key: 'identifier', class_name: 'Labimotion::StdLayersRevision'
8
8
  end
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Labimotion
4
4
  class StdLayersRevision < ApplicationRecord
5
5
  acts_as_paranoid
6
- self.table_name = :l_s_lyrs_tracks
7
- belongs_to :l_s_lyrs, primary_key: 'identifier', foreign_key: 'identifier', class_name: 'Labimotion::StdLayer'
6
+ self.table_name = :layer_tracks
7
+ belongs_to :layers, primary_key: 'identifier', foreign_key: 'identifier', class_name: 'Labimotion::StdLayer'
8
8
  end
9
9
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '1.5.0.rc8'
5
+ VERSION = '2.0.0.rc1'
6
6
  end
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.5.0.rc8
4
+ version: 2.0.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-11-22 00:00:00.000000000 Z
12
+ date: 2024-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails