labimotion 1.5.0.rc2 → 1.5.0.rc4

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: 3afb085685be0c64eb0eca90f28704e5f5305c41cb61c2f6b8a3bd13b5e2c452
4
+ data.tar.gz: 0caa5656084de5a97b354cb1f7f10f8ffc016f326feb99b207d5f5a6c6453874
5
5
  SHA512:
6
- metadata.gz: 4e7c44330b99cb08d05a3f2402566bd6cde2e384d917e9a9ebd19963f5261ea8e08422d932b11d551b81e23b9c202896ab169091fd680eb962b1d6deb4f9a902
7
- data.tar.gz: c7fb2ab0e3eead1f32601ad3b4b952ad9d45e56540f9add8e7520eb6790bc464a6778d515e002d6050dfd5f7b0b85fdac7a22bf6a06b5c3c7111d9a64cc6e9be
6
+ metadata.gz: 2a9d39347435dcbc76a8a400e22bd5d7cd45278ca83c9bf32ff690bca3bed7d714c2f5d8dcab0859f062b14bc5cfbb81e73d097c25829a622ed1f16597164f12
7
+ data.tar.gz: b6b346ea8463d6a0a5e70d17a7797ae8db50b25d810e0c37a0de497ce00ff0a725da23490dd7aae9ef709182d0da9497a36ff946d35cfacbfcf2f5878aa93e63
@@ -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.rc4'
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.rc4
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-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails