labimotion 1.0.5 → 1.0.6
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 +5 -5
- data/lib/labimotion/helpers/element_helpers.rb +10 -1
- data/lib/labimotion/libs/export_dataset.rb +1 -1
- data/lib/labimotion/models/concerns/workflow.rb +9 -0
- data/lib/labimotion/models/element.rb +2 -1
- data/lib/labimotion/models/element_klass.rb +0 -8
- data/lib/labimotion/models/segment_klass.rb +1 -0
- data/lib/labimotion/utils/export.rb +20 -0
- data/lib/labimotion/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cb214fd84c4c884358893ea3a5c7af5504bf3c9d366747d95c4c86aa6f2c42e
|
4
|
+
data.tar.gz: 5ec0a7b4e10b6174ba9802648c9f9f15e85c03b491035d375b06ee85e25ce15e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c2c0a26c8c8ce05d44f976d1146464f72c1dd173529cff04fa9918863c8f074f69299d90d2d9fefafcd5628a5dd28d29ade1b5b9029b4aac88602f05d64db90
|
7
|
+
data.tar.gz: 67bfe5f4e12b5b8412a95fd4124818dfb4da775baa2558e4934c4b8b86d79c43c0c65f51070e4893ef3cf857bfae2e3efd6061bbbd1b5b5759917bfed936568d
|
@@ -318,7 +318,7 @@ module Labimotion
|
|
318
318
|
if Labimotion::IS_RAILS5 == true
|
319
319
|
{
|
320
320
|
element: ElementPermissionProxy.new(current_user, element, user_ids).serialized,
|
321
|
-
attachments:
|
321
|
+
attachments: attach_thumbnail(element&.attachments)
|
322
322
|
}
|
323
323
|
else
|
324
324
|
{
|
@@ -326,7 +326,7 @@ module Labimotion
|
|
326
326
|
element,
|
327
327
|
detail_levels: ElementDetailLevelCalculator.new(user: current_user, element: element).detail_levels,
|
328
328
|
),
|
329
|
-
attachments:
|
329
|
+
attachments: attach_thumbnail(element&.attachments)
|
330
330
|
}
|
331
331
|
end
|
332
332
|
rescue StandardError => e
|
@@ -350,7 +350,7 @@ module Labimotion
|
|
350
350
|
if Labimotion::IS_RAILS5 == true
|
351
351
|
{
|
352
352
|
element: ElementPermissionProxy.new(current_user, element, user_ids).serialized,
|
353
|
-
attachments:
|
353
|
+
attachments: attach_thumbnail(element&.attachments)
|
354
354
|
}
|
355
355
|
else
|
356
356
|
present(
|
@@ -386,7 +386,7 @@ module Labimotion
|
|
386
386
|
if Labimotion::IS_RAILS5 == true
|
387
387
|
{
|
388
388
|
element: ElementPermissionProxy.new(current_user, element, user_ids).serialized,
|
389
|
-
attachments:
|
389
|
+
attachments: attach_thumbnail(element&.attachments)
|
390
390
|
}
|
391
391
|
else
|
392
392
|
{
|
@@ -394,7 +394,7 @@ module Labimotion
|
|
394
394
|
element,
|
395
395
|
detail_levels: ElementDetailLevelCalculator.new(user: current_user, element: element).detail_levels,
|
396
396
|
),
|
397
|
-
attachments:
|
397
|
+
attachments: attach_thumbnail(element&.attachments),
|
398
398
|
}
|
399
399
|
end
|
400
400
|
rescue StandardError => e
|
@@ -159,7 +159,7 @@ module Labimotion
|
|
159
159
|
att_ary = create_attachments(
|
160
160
|
params[:attfiles],
|
161
161
|
params[:delfiles],
|
162
|
-
params[:att_type],
|
162
|
+
"Labimotion::#{params[:att_type]}",
|
163
163
|
params[:att_id],
|
164
164
|
params[:attfilesIdentifier],
|
165
165
|
current_user.id
|
@@ -326,5 +326,14 @@ module Labimotion
|
|
326
326
|
raise e
|
327
327
|
end
|
328
328
|
|
329
|
+
def attach_thumbnail(_attachments)
|
330
|
+
attachments = _attachments&.map do |attachment|
|
331
|
+
_att = Entities::AttachmentEntity.represent(attachment, serializable: true)
|
332
|
+
_att[:thumbnail] = attachment.thumb ? Base64.encode64(attachment.read_thumbnail) : nil
|
333
|
+
_att
|
334
|
+
end
|
335
|
+
attachments
|
336
|
+
end
|
337
|
+
|
329
338
|
end
|
330
339
|
end
|
@@ -101,7 +101,7 @@ module Labimotion
|
|
101
101
|
cds = Container.find(id)
|
102
102
|
cds.attachments.where(aasm_state: 'csv').each do |att|
|
103
103
|
name = File.basename(att.filename, '.csv')
|
104
|
-
sheet = @xfile.workbook.add_worksheet(name: name)
|
104
|
+
sheet = @xfile.workbook.add_worksheet(name: name.slice(0, 25))
|
105
105
|
|
106
106
|
if Labimotion::IS_RAILS5 == true
|
107
107
|
File.open(att.store.path) do |fi|
|
@@ -23,5 +23,14 @@ module Labimotion
|
|
23
23
|
end
|
24
24
|
properties
|
25
25
|
end
|
26
|
+
|
27
|
+
def migrate_workflow
|
28
|
+
return if properties_template.nil? || properties_release.nil?
|
29
|
+
|
30
|
+
return if properties_template['flow'].nil? && properties_release['flow'].nil?
|
31
|
+
|
32
|
+
update_column(:properties_template, split_workflow(properties_template)) if properties_template['flow']
|
33
|
+
update_column(:properties_release, split_workflow(properties_release)) if properties_release['flow']
|
34
|
+
end
|
26
35
|
end
|
27
36
|
end
|
@@ -12,6 +12,7 @@ module Labimotion
|
|
12
12
|
include ElementUIStateScopes
|
13
13
|
include Collectable
|
14
14
|
## include AnalysisCodes
|
15
|
+
include ElementCodes
|
15
16
|
include Taggable
|
16
17
|
include Workflow
|
17
18
|
include Segmentable
|
@@ -58,7 +59,7 @@ module Labimotion
|
|
58
59
|
|
59
60
|
|
60
61
|
def attachments
|
61
|
-
Attachment.where(attachable_id: self.id, attachable_type:
|
62
|
+
Attachment.where(attachable_id: self.id, attachable_type: self.class.name)
|
62
63
|
end
|
63
64
|
|
64
65
|
def self.get_associated_samples(element_ids)
|
@@ -23,13 +23,5 @@ module Labimotion
|
|
23
23
|
)
|
24
24
|
end
|
25
25
|
|
26
|
-
def migrate_workflow
|
27
|
-
return if properties_template.nil? || properties_release.nil?
|
28
|
-
|
29
|
-
return if properties_template['flow'].nil? && properties_release['flow'].nil?
|
30
|
-
|
31
|
-
update_column(:properties_template, split_workflow(properties_template)) if properties_template['flow']
|
32
|
-
update_column(:properties_release, split_workflow(properties_release)) if properties_release['flow']
|
33
|
-
end
|
34
26
|
end
|
35
27
|
end
|
@@ -6,6 +6,7 @@ module Labimotion
|
|
6
6
|
self.table_name = :segment_klasses
|
7
7
|
acts_as_paranoid
|
8
8
|
include GenericKlassRevisions
|
9
|
+
include Workflow
|
9
10
|
belongs_to :element_klass, class_name: 'Labimotion::ElementKlass'
|
10
11
|
has_many :segments, dependent: :destroy, class_name: 'Labimotion::Segment'
|
11
12
|
has_many :segment_klasses_revisions, dependent: :destroy, class_name: 'Labimotion::SegmentKlassesRevision'
|
@@ -22,6 +22,26 @@ module Labimotion
|
|
22
22
|
fetch_many.call(klasses, {'created_by' => 'User'})
|
23
23
|
end
|
24
24
|
|
25
|
+
def self.fetch_elements(collection, segments, attachments, fetch_many, fetch_one, fetch_containers)
|
26
|
+
fetch_many.call(collection.elements, {
|
27
|
+
'element_klass_id' => 'Labimotion::ElementKlass',
|
28
|
+
'created_by' => 'User',
|
29
|
+
})
|
30
|
+
fetch_many.call(collection.collections_elements, {
|
31
|
+
'collection_id' => 'Collection',
|
32
|
+
'element_id' => 'Labimotion::Element',
|
33
|
+
})
|
34
|
+
collection.elements.each do |element|
|
35
|
+
|
36
|
+
element, attachments = Labimotion::Export.fetch_properties(element, attachments, &fetch_one)
|
37
|
+
fetch_containers.call(element)
|
38
|
+
segment, @attachments = Labimotion::Export.fetch_segments(element, attachments, &fetch_one)
|
39
|
+
segments += segment if segment.present?
|
40
|
+
end
|
41
|
+
|
42
|
+
[segments, attachments]
|
43
|
+
|
44
|
+
end
|
25
45
|
|
26
46
|
def self.fetch_segments(element, attachments, &fetch_one)
|
27
47
|
element_type = element.class.name
|
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.0.
|
4
|
+
version: 1.0.6
|
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: 2023-
|
12
|
+
date: 2023-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|