labimotion 1.0.12 → 1.0.13

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: 7ddd7650762797d557ff280a60b4bb89bea1a3514941e741f4c0cb8c4b87e4ab
4
- data.tar.gz: 146b83a224742e7a75f39c606b71259a0a217dbbea679dc6010be8c11cb7d26e
3
+ metadata.gz: 6fee76937fb58a56cbe5ccbfa23deaf60ec7270ce18962697232baba381864bc
4
+ data.tar.gz: 4f9c52e1d367b7e267ffd2e1933e1a0986e714baf53095f06d4c3a740e4d5dff
5
5
  SHA512:
6
- metadata.gz: 91c70dea416babdc050b80793020c614ad4d2ddb07632ffca1186919f9b4e149a98c7f0840b7c2f3c5876d0c75c465f1038fe3392a13a35092d109a92c211b89
7
- data.tar.gz: 8e71a05bc1215ce367a80f6e48a2452256b0236d7392cc394229c0bfc18d739d81004e86f5e0a25a8ee3d03c35f30eb32f67715f4437e219f7780d549b79e218
6
+ metadata.gz: '0578eec6bf64edda52b79d66dd635ced6b99c6d73e28cec5f4cd3e14bd8c669c5ef1b75a7464564f73f38492d6565cafa77ee3f0a6aa2e4ee1cd9af7d04dbc85'
7
+ data.tar.gz: f16f35d5efe1f6b06271c8675903137021d541acdd5e3dca9a58ee7a9cca08c69a73a508a2e972d206bf54e9ccb8b26dedd19032bd8ab35cc3709d4d8d2fe5a0
@@ -27,7 +27,7 @@ module Labimotion
27
27
  name = ds.dataset_klass.label
28
28
 
29
29
  match = name.match(/\((.*?)\)/)
30
- name = match && match.length > 2 ? match[1] : name
30
+ name = match && match.length > 1 ? match[1] : name
31
31
 
32
32
  name = '1H NMR' if ds.dataset_klass.ols_term_id == 'CHMO:0000593'
33
33
  name = '13C NMR' if ds.dataset_klass.ols_term_id == 'CHMO:0000595'
@@ -99,9 +99,14 @@ module Labimotion
99
99
  wb = @xfile.workbook
100
100
  gds = Labimotion::Dataset.find_by(element_id: id, element_type: 'Container')
101
101
  cds = Container.find(id)
102
- cds.attachments.where(aasm_state: 'csv').each_with_index do |att, idx|
102
+ cds_csv = cds.attachments.where(aasm_state: 'csv')
103
+ csv_length = cds_csv.length
104
+ return if csv_length.zero?
105
+ cds_csv.each_with_index do |att, idx|
103
106
  name = File.basename(att.filename, '.csv')
104
- sheet = @xfile.workbook.add_worksheet(name: "#{name.slice(0, 25)}_#{idx + 1}")
107
+ name = name.slice(0, (25 - csv_length.to_s.length - 1))
108
+ sheet_name = "#{name}_#{idx}"
109
+ sheet = @xfile.workbook.add_worksheet(name: sheet_name)
105
110
 
106
111
  if Labimotion::IS_RAILS5 == true
107
112
  File.open(att.store.path) do |fi|
@@ -3,7 +3,7 @@
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
5
  IS_RAILS5 = false
6
- VERSION_ELN = '1.0.12'
6
+ VERSION_ELN = '1.0.13'
7
7
  VERSION_REPO = '0.3.1'
8
8
 
9
9
  VERSION = Labimotion::VERSION_REPO if Labimotion::IS_RAILS5 == true
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.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chia-Lin Lin