labimotion 1.1.1 → 1.1.4

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: 75c0801b117991ca8b6dc96daebfedbfdbdc7d40e31bb8c78fbc3f1089eaff91
4
+ data.tar.gz: 5f67c104d53b3388549064ab3c8e7bebe5df7d39d1075c3d5c42dce5eee9e07e
5
5
  SHA512:
6
- metadata.gz: cafa053063812ca19f6ada0142715a9063ad8c8f7c9e0f2c592e09a104eeef6c45e6660804e8b098d6d18c05b60fe4e5e89ff3e2b019c9c474f131f601b70a13
7
- data.tar.gz: 94ca185e56c817789ba34c320d32d85cfb78e679f37b77a00ae3b194c1d0eecae4364e142f40dd52392821dcff7cee2dccbb2841aad55992da51df5c6759de1e
6
+ metadata.gz: a0c036e9a1fc5f3b44130a2e7bf0038f2d0476461ca6a18994564752cf42737486c4d67ec61a0d698af9f28e92bf04c506035954d13b8dbdd2f5a67722c4b694
7
+ data.tar.gz: 32721efb59f25ed9c2b5ec853987416e2073ab3612881541a9e1e79d2134076998ed18a29cec4efac778f121e6faa3e27d72f0d44e34653e01e9c79e3bebaf95
@@ -262,7 +262,6 @@ module Labimotion
262
262
  end
263
263
  new_prop.dig('layers', 'general', 'fields')&.each_with_index do |fi, idx|
264
264
  if fi['field'] == 'creator' && current_user.present?
265
- fi['label'] = fi['label']
266
265
  fi['value'] = current_user.name
267
266
  fi['system'] = current_user.name
268
267
  new_prop['layers']['general']['fields'][idx] = fi
@@ -273,13 +272,13 @@ module Labimotion
273
272
  if fi['field'] == 'id'
274
273
  fi['value'] = element.id
275
274
  fi['system'] = element.id
276
- new_prop['layers']['general']['fields'][idx] = fi
275
+ new_prop['layers']['sample_details']['fields'][idx] = fi
277
276
  end
278
277
 
279
278
  if fi['field'] == 'label'
280
279
  fi['value'] = element.short_label
281
280
  fi['system'] = element.short_label
282
- new_prop['layers']['general']['fields'][idx] = fi
281
+ new_prop['layers']['sample_details']['fields'][idx] = fi
283
282
  end
284
283
  end
285
284
  dataset.properties = new_prop
@@ -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.4'
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.4
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-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails