labimotion 1.1.0 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c374697be6dd59785865b85ea34a92de6d9e87d8d0fe9d5416b5b58c5f18f11
4
- data.tar.gz: 11b8842141477f92d08e50c0fc55c29f82c7a098dc8c08ed9be610b9d037c0ae
3
+ metadata.gz: a6f7936de192e1d9fe1f8bacc78699fc0bf97ac70a8527ef82401b58822e3c34
4
+ data.tar.gz: 419291e71d602c493841fd560abb7c3fabd1959e6fa5217b71eb40f0ff15ef38
5
5
  SHA512:
6
- metadata.gz: 0ebbb6edd334c5f13bbf3196cc7f5b56510019925f516abb35404b0943c9546e21fd16227ffebe5365955d9202b7201b795fac019c72050d0a59f902d4aa70ca
7
- data.tar.gz: eded51a9e589660b0a6dcf20187eb715e946448fa9a047263176212c0136d0a648c9015d50a3de0ae06ea39ba6942fcfc23e00b085aecaa583e8faa57e67f1ee
6
+ metadata.gz: 1bfd9d6c59caabdeb559230074000e3e79ffb7bf30699a70b94358bbf7551c31652c4cd85ab20dda6fc902e556e7440ad7243b4452752cf543e462b0ac9dd721
7
+ data.tar.gz: ba6e063f02f5930c687d23d857ddc71446889d19ae9461b4bfc5600ebdbdac4c39bc1d36196041e0f3bbdb6c9b95502c76639ce2e5c05ff1752dd366ba35cf0b
@@ -18,7 +18,7 @@ module Labimotion
18
18
  elsif result[:metadata] == nil
19
19
  Labimotion::ConState::NONE
20
20
  else
21
- data = process(att, id, content)
21
+ data = process(att, id, result[:metadata])
22
22
  generate_ds(id, att.attachable_id, data, current_user)
23
23
  Labimotion::ConState::COMPLETED
24
24
  end
@@ -7,7 +7,7 @@ module Labimotion
7
7
  module Segmentable
8
8
  extend ActiveSupport::Concern
9
9
  included do
10
- has_many :segments, as: :element, dependent: :destroy, class_name: 'Labimotion::Segment'
10
+ has_many :segments, -> { select('DISTINCT ON (element_type, segment_klass_id) *').order(element_type: :asc, segment_klass_id: :asc, id: :desc) }, as: :element, dependent: :destroy, class_name: 'Labimotion::Segment'
11
11
  end
12
12
 
13
13
  def copy_segments(**args)
@@ -52,10 +52,11 @@ module Labimotion
52
52
  props['uuid'] = uuid
53
53
  props['klass'] = 'Segment'
54
54
  props = Labimotion::SampleAssociation.update_sample_association(props, args[:current_user_id])
55
- segment = Labimotion::Segment.find_by(element_type: Labimotion::Utils.element_name(self.class.name), element_id: self.id, segment_klass_id: seg['segment_klass_id'])
55
+ segment = Labimotion::Segment.where(element_type: self.class.name, element_id: self.id, segment_klass_id: seg['segment_klass_id']).order(id: :desc).first
56
56
  if segment.present? && (segment.klass_uuid != props['klass_uuid'] || segment.properties != props)
57
57
  segment.update!(properties_release: klass.properties_release, properties: props, uuid: uuid, klass_uuid: props['klass_uuid'])
58
58
  segments.push(segment)
59
+ Labimotion::Segment.where(element_type: self.class.name, element_id: self.id, segment_klass_id: seg['segment_klass_id']).where.not(id: segment.id).destroy_all
59
60
  end
60
61
  next if segment.present?
61
62
 
@@ -3,5 +3,5 @@
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
5
  IS_RAILS5 = false
6
- VERSION = '1.1.0'
6
+ VERSION = '1.1.2'
7
7
  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.1.0
4
+ version: 1.1.2
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-01-12 00:00:00.000000000 Z
12
+ date: 2024-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails