labimotion 1.1.1 → 1.1.3

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: 31b676c3d3b051e9dae4da02b070aa56235b835d01b773d29096a0be2a946edc
4
- data.tar.gz: 760e38c37701899c5a52320096a936b8c559828a807a62400182314c1e4efe02
3
+ metadata.gz: ba9c0a13422ef51e2463f066ca1520dec3e8dbb49df8a448456dcce071be8eb0
4
+ data.tar.gz: 9db0ceb23bb34a5dedf6e7f1a139218e23e76c76a4cc6b2df710ac7faa885ccf
5
5
  SHA512:
6
- metadata.gz: cafa053063812ca19f6ada0142715a9063ad8c8f7c9e0f2c592e09a104eeef6c45e6660804e8b098d6d18c05b60fe4e5e89ff3e2b019c9c474f131f601b70a13
7
- data.tar.gz: 94ca185e56c817789ba34c320d32d85cfb78e679f37b77a00ae3b194c1d0eecae4364e142f40dd52392821dcff7cee2dccbb2841aad55992da51df5c6759de1e
6
+ metadata.gz: 299af77b27b54a9ad05f7d4ca60617d5bf44b3346eff277f29166fb9be1dd6f97b6505b521b4990cf0c6dd0e6cb31f138b375557cd26616801b3fd4427e9c84a
7
+ data.tar.gz: 0d15088710b59d7ec17a9c1692ca56dd4dd8ce08bc2b49dae3c4a4ee374af7496957905b07b6ecbbf256c49ce82a865c7cb80e8fde0a2013aa41515fa711ab8a
@@ -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.1'
6
+ VERSION = '1.1.3'
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.1
4
+ version: 1.1.3
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-16 00:00:00.000000000 Z
12
+ date: 2024-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails