labimotion 1.5.0.rc2 → 1.5.0.rc3

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: 8c27e1abca5ba7bf25eb28196a873d27529c9f15a642c68359f548ab8908eb53
4
- data.tar.gz: 2aec966843e9e8e1665afd6e6c874965bb7790d7a919802bb942c06548ce602a
3
+ metadata.gz: 4bf785dda2ca949138e3d5f9b5047c3a8696c6171af31b54ee02072f98aa9d58
4
+ data.tar.gz: c90714bacc5941ca475ec8e75f2355ba4e2f5b347f14d49e649e0496799b1ba5
5
5
  SHA512:
6
- metadata.gz: 4e7c44330b99cb08d05a3f2402566bd6cde2e384d917e9a9ebd19963f5261ea8e08422d932b11d551b81e23b9c202896ab169091fd680eb962b1d6deb4f9a902
7
- data.tar.gz: c7fb2ab0e3eead1f32601ad3b4b952ad9d45e56540f9add8e7520eb6790bc464a6778d515e002d6050dfd5f7b0b85fdac7a22bf6a06b5c3c7111d9a64cc6e9be
6
+ metadata.gz: cbfb288dc3f358efe920ea49f135208024443e09512f122e7adac44defeafcc3391b4948f9cfea9bfc78fc6597134426bcbc6237733a9101ca69acc264c675f4
7
+ data.tar.gz: 9badebc9b2f3040b1d9c52d4a19bed4a05b7ba03677a044a1451dbf11c647b659a2875b054a2e20412cbcc6d049d568f208148a5312b7996194f74b2f76b89ed
@@ -48,16 +48,15 @@ module Labimotion
48
48
  get do
49
49
  # merged_data = []
50
50
  # Dir.glob(Rails.public_path.join('generic', 'vocabularies', '*.json')).each do |file_path|
51
- merged_data = []
52
- Dir.glob(Rails.public_path.join('generic', 'vocabularies', '*.json')).each do |file_path|
53
- file_content = File.read(file_path)
54
- json_data = JSON.parse(file_content)
55
- merged_data.concat(json_data)
56
- end
51
+ # file_content = File.read(file_path)
52
+ # json_data = JSON.parse(file_content)
53
+ # merged_data.concat(json_data)
54
+ # end
57
55
 
58
- list = Labimotion::Vocabulary.all.sort_by { |e| e.name }
59
- data = Labimotion::VocabularyEntity.represent(list, serializable: true)
60
- combined_data = merged_data + data
56
+ # list = Labimotion::Vocabulary.all.sort_by { |e| e.name }
57
+ # present list, with: Labimotion::StdLayer, root: 'klass'
58
+ combined_data = Labimotion::VocabularyHandler.load_all_vocabularies
59
+ # combined_data = Labimotion::VocabularyEntity.represent(vocabularies, serializable: true)
61
60
  return { mc: 'ss00', data: combined_data }
62
61
  rescue StandardError => e
63
62
  Labimotion.log_exception(e, current_user)
@@ -9,7 +9,7 @@ module Labimotion
9
9
  (object&.properties.is_a?(Hash) && object.properties[Labimotion::Prop::LAYERS]&.keys || []).each do |key|
10
10
  # layer = object.properties[key]
11
11
 
12
- # field_vocabularies = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].select { |ss| ss['is_vocabulary'] == true}
12
+ # field_vocabularies = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].select { |ss| ss['is_voc'] == true}
13
13
  # field_vocabularies.each do |field|
14
14
  # idx = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
15
15
  # if field['identifier'] == '7c30cd4f-aef4-433a-946e-d0f81f8918f1'
@@ -6,7 +6,7 @@ module Labimotion
6
6
  def self.update_vocabularies(properties, current_user, element)
7
7
  properties[Labimotion::Prop::LAYERS].keys.each do |key|
8
8
  layer = properties[Labimotion::Prop::LAYERS][key]
9
- field_vocabularies = layer[Labimotion::Prop::FIELDS].select { |ss| ss['is_vocabulary'] == true && ss['opid'] == 9}
9
+ field_vocabularies = layer[Labimotion::Prop::FIELDS].select { |ss| ss['is_voc'] == true && ss['opid'] == 9}
10
10
  field_vocabularies.each do |field|
11
11
  idx = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
12
12
  val = ''
@@ -72,18 +72,23 @@ module Labimotion
72
72
 
73
73
  def self.load_from_files
74
74
  merged_data = []
75
- dir_path = Rails.root.join('lib', 'labimotion', 'libs', 'data', 'vocab')
76
- Dir.glob(dir_path.join('*.json')).each do |file_path|
77
- file_content = File.read(file_path)
78
- json_data = JSON.parse(file_content)
79
- merged_data.concat(json_data)
80
- end
75
+ # byebug
76
+ sys_json = File.join(__dir__, 'data', 'vocab', 'System.json')
77
+ # byebug
78
+ file_content = File.read(sys_json)
79
+ json_data = JSON.parse(file_content)
80
+ merged_data.concat(json_data)
81
+
82
+ std_json = File.join(__dir__, 'data', 'vocab', 'Standard.json')
83
+ file_content = File.read(std_json)
84
+ json_data = JSON.parse(file_content)
85
+ merged_data.concat(json_data)
81
86
  merged_data
82
87
  end
83
88
 
84
89
  def self.load_from_database
85
- Labimotion::Vocabulary.all.sort_by(&:name)
86
- # Labimotion::VocabularyEntity.represent(Labimotion::Vocabulary.all.sort_by(&:name), serializable: true)
90
+ vocabularies = Labimotion::Vocabulary.all.sort_by(&:name)
91
+ Labimotion::VocabularyEntity.represent(vocabularies, serializable: true)
87
92
  end
88
93
 
89
94
  private_class_method :load_from_files, :load_from_database
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '1.5.0.rc2'
5
+ VERSION = '1.5.0.rc3'
6
6
  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.5.0.rc2
4
+ version: 1.5.0.rc3
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-10-01 00:00:00.000000000 Z
12
+ date: 2024-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails