labimotion 2.1.0.rc6 → 2.1.0.rc8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/labimotion/apis/generic_element_api.rb +2 -1
- data/lib/labimotion/apis/generic_klass_api.rb +2 -1
- data/lib/labimotion/entities/element_revision_entity.rb +2 -0
- data/lib/labimotion/entities/eln_element_entity.rb +2 -0
- data/lib/labimotion/entities/properties_entity.rb +4 -0
- data/lib/labimotion/entities/segment_revision_entity.rb +2 -0
- data/lib/labimotion/libs/export_element.rb +1 -0
- data/lib/labimotion/libs/properties_handler.rb +2 -2
- data/lib/labimotion/libs/sample_association.rb +3 -1
- data/lib/labimotion/models/element_klass.rb +1 -1
- data/lib/labimotion/models/segment_klass.rb +1 -1
- data/lib/labimotion/utils/serializer.rb +2 -0
- data/lib/labimotion/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1ded6e04ed88c0888ce184a58663ac2f91bbeb00f8e8e67f1feb70f6d53a3a39
|
|
4
|
+
data.tar.gz: e7cc351ed12b84cc6dad32705bdb0297addb5a9400445c72cbb4fdf7417c8bb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 440d75c561f6ca9754f346bbdaf8da71efe2402a3ac569eb673ac24de94a654cbd45af1ef8d19edde2f9dfb488e9f1d692931eab9e8b3c77f1ba6a1858a93458
|
|
7
|
+
data.tar.gz: e86ff2f885489b280616f42d21806a33047cd2257296149ac56763efcb42e0d24b1ae303fce30d108b3431f0259b3204c2e223037321b0f2ee4908038f8ab73a
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'cgi'
|
|
3
4
|
require 'labimotion/conf'
|
|
4
5
|
require 'labimotion/libs/export_element'
|
|
5
6
|
|
|
@@ -138,7 +139,7 @@ module Labimotion
|
|
|
138
139
|
env['api.format'] = :binary
|
|
139
140
|
content_type 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
|
140
141
|
el_filename = export.res_name
|
|
141
|
-
filename =
|
|
142
|
+
filename = CGI.escape(el_filename)
|
|
142
143
|
# header['Content-Disposition'] = "attachment; filename=abc.docx"
|
|
143
144
|
header('Content-Disposition', "attachment; filename=\"#{filename}\"")
|
|
144
145
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'cgi'
|
|
3
4
|
require 'labimotion/version'
|
|
4
5
|
require 'labimotion/libs/export_element'
|
|
5
6
|
|
|
@@ -20,7 +21,7 @@ module Labimotion
|
|
|
20
21
|
entity.update_columns(identifier: SecureRandom.uuid) if entity&.identifier.nil?
|
|
21
22
|
env['api.format'] = :binary
|
|
22
23
|
content_type('application/json')
|
|
23
|
-
filename =
|
|
24
|
+
filename = CGI.escape("LabIMotion_#{params[:klass]}_#{entity.label}-#{Time.new.strftime("%Y%m%d%H%M%S")}.json")
|
|
24
25
|
# header['Content-Disposition'] = "attachment; filename=abc.docx"
|
|
25
26
|
header('Content-Disposition', "attachment; filename=\"#{filename}\"")
|
|
26
27
|
"Labimotion::#{params[:klass]}Entity".constantize.represent(entity)
|
|
@@ -13,6 +13,8 @@ module Labimotion
|
|
|
13
13
|
object.properties[Labimotion::Prop::LAYERS]&.keys.each do |key|
|
|
14
14
|
field_sample_molecules = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::DRAG_SAMPLE || ss['type'] == Labimotion::FieldType::DRAG_MOLECULE }
|
|
15
15
|
field_sample_molecules.each do |field|
|
|
16
|
+
next unless field['value'].is_a?(Hash)
|
|
17
|
+
|
|
16
18
|
idx = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
|
17
19
|
sid = field.dig('value', 'el_id')
|
|
18
20
|
next unless sid.present?
|
|
@@ -30,6 +30,8 @@ module Labimotion
|
|
|
30
30
|
ss['type'] == Labimotion::FieldType::DRAG_SAMPLE || ss['type'] == Labimotion::FieldType::DRAG_MOLECULE
|
|
31
31
|
end
|
|
32
32
|
field_sample_molecules.each do |field|
|
|
33
|
+
next unless field['value'].is_a?(Hash)
|
|
34
|
+
|
|
33
35
|
idx = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
|
34
36
|
sid = field.dig('value', 'el_id')
|
|
35
37
|
next unless sid.present?
|
|
@@ -58,6 +58,8 @@ module Labimotion
|
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
def update_sample_or_molecule_field(key, field, idx)
|
|
61
|
+
return unless field['value'].is_a?(Hash)
|
|
62
|
+
|
|
61
63
|
sid = field.dig('value', 'el_id')
|
|
62
64
|
return unless sid.present?
|
|
63
65
|
|
|
@@ -79,6 +81,8 @@ module Labimotion
|
|
|
79
81
|
end
|
|
80
82
|
|
|
81
83
|
def update_reaction_field(key, field, idx)
|
|
84
|
+
return unless field['value'].is_a?(Hash)
|
|
85
|
+
|
|
82
86
|
sid = field.dig('value', 'el_id')
|
|
83
87
|
return unless sid.present?
|
|
84
88
|
|
|
@@ -12,6 +12,8 @@ module Labimotion
|
|
|
12
12
|
object.properties[Labimotion::Prop::LAYERS]&.keys.each do |key|
|
|
13
13
|
field_sample_molecules = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::DRAG_SAMPLE || ss['type'] == Labimotion::FieldType::DRAG_MOLECULE }
|
|
14
14
|
field_sample_molecules.each do |field|
|
|
15
|
+
next unless field['value'].is_a?(Hash)
|
|
16
|
+
|
|
15
17
|
idx = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
|
16
18
|
sid = field.dig('value', 'el_id')
|
|
17
19
|
next unless sid.present?
|
|
@@ -8,9 +8,9 @@ module Labimotion
|
|
|
8
8
|
def check_val(field, type)
|
|
9
9
|
case type
|
|
10
10
|
when Labimotion::FieldType::DRAG_SAMPLE, Labimotion::FieldType::DRAG_ELEMENT
|
|
11
|
-
return field.dig('value', 'el_id').present?
|
|
11
|
+
return field['value'].is_a?(Hash) && field.dig('value', 'el_id').present?
|
|
12
12
|
when Labimotion::FieldType::UPLOAD
|
|
13
|
-
return field.dig('value', 'files')&.length&.positive?
|
|
13
|
+
return field['value'].is_a?(Hash) && field.dig('value', 'files')&.length&.positive?
|
|
14
14
|
when Labimotion::FieldType::TABLE
|
|
15
15
|
return field[Labimotion::Prop::SUBFIELDS]&.length&.positive? && field['sub_values']&.length&.positive?
|
|
16
16
|
end
|
|
@@ -79,6 +79,7 @@ module Labimotion
|
|
|
79
79
|
field_samples.each do |field|
|
|
80
80
|
idx = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
|
81
81
|
return if field.is_a?(String) || properties.is_a?(String)
|
|
82
|
+
next unless field['value'].is_a?(Hash)
|
|
82
83
|
|
|
83
84
|
sid = field.dig('value', 'el_id')
|
|
84
85
|
next if sid.blank?
|
|
@@ -102,7 +103,8 @@ module Labimotion
|
|
|
102
103
|
field_elements = layer[Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::DRAG_ELEMENT }
|
|
103
104
|
field_elements.each do |field|
|
|
104
105
|
idx = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
|
105
|
-
|
|
106
|
+
return if field.is_a?(String) || properties.is_a?(String)
|
|
107
|
+
next unless field['value'].is_a?(Hash)
|
|
106
108
|
|
|
107
109
|
sid = field.dig('value', 'el_id')
|
|
108
110
|
next if element.nil? || sid.blank? || sid == element.id
|
|
@@ -16,7 +16,7 @@ module Labimotion
|
|
|
16
16
|
has_many :segment_klasses, dependent: :destroy, class_name: 'Labimotion::SegmentKlass'
|
|
17
17
|
has_many :element_klasses_revisions, dependent: :destroy, class_name: 'Labimotion::ElementKlassesRevision'
|
|
18
18
|
|
|
19
|
-
validates :name, presence: true, uniqueness: { message: 'is already in use.' }
|
|
19
|
+
validates :name, presence: true, uniqueness: { conditions: -> { where(deleted_at: nil) }, message: 'is already in use.' }
|
|
20
20
|
|
|
21
21
|
# Scope for displayed_in_list - select only necessary columns for list view
|
|
22
22
|
scope :for_list_display, lambda {
|
|
@@ -15,7 +15,7 @@ module Labimotion
|
|
|
15
15
|
has_many :segments, dependent: :destroy, class_name: 'Labimotion::Segment'
|
|
16
16
|
has_many :segment_klasses_revisions, dependent: :destroy, class_name: 'Labimotion::SegmentKlassesRevision'
|
|
17
17
|
|
|
18
|
-
validates :label, presence: true, uniqueness: { scope: :element_klass_id, message: 'is already in use.' }
|
|
18
|
+
validates :label, presence: true, uniqueness: { scope: :element_klass_id, conditions: -> { where(deleted_at: nil) }, message: 'is already in use.' }
|
|
19
19
|
|
|
20
20
|
# Scope for displayed_in_list - select only necessary columns for list view
|
|
21
21
|
scope :for_list_display, lambda {
|
|
@@ -37,6 +37,8 @@ module Labimotion
|
|
|
37
37
|
# layer = object.properties[key]
|
|
38
38
|
field_sample_molecules = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].select { |ss| Labimotion::FieldType::DRAG_ALL.include?(ss['type']) }
|
|
39
39
|
field_sample_molecules.each do |field|
|
|
40
|
+
next unless field['value'].is_a?(Hash)
|
|
41
|
+
|
|
40
42
|
idx = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
|
41
43
|
sid = field.dig('value') != '' && field.dig('value', 'el_id')
|
|
42
44
|
next unless sid.present?
|
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: 2.1.0.
|
|
4
|
+
version: 2.1.0.rc8
|
|
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: 2025-
|
|
12
|
+
date: 2025-11-02 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: caxlsx
|
|
@@ -175,6 +175,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
175
175
|
- - ">="
|
|
176
176
|
- !ruby/object:Gem::Version
|
|
177
177
|
version: '2.7'
|
|
178
|
+
- - "<"
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: '3.4'
|
|
178
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
182
|
requirements:
|
|
180
183
|
- - ">"
|