apidae 1.4.15 → 1.4.16

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: 829fbcc39fd6110c0bbe6900004d1ed3e0efc2a0a345e1c2e0addd151b045d3f
4
- data.tar.gz: e8501491443543d72b6fc710ae0a1bcbe18cdaaa40df2942008d1cbc2b0dd625
3
+ metadata.gz: 44f3b5a191f7f2f610620e188d2be34c993a5a809fb669732ebcdbed450c1f8b
4
+ data.tar.gz: 7ffceca9b1cdd04cf30765c28e232a222ed70b39c78cf768637b0864ac98a798
5
5
  SHA512:
6
- metadata.gz: 5fae148c4eec799645b90c2be7dc211d76211e4a516ab4cbe960d6e436b501462b792670058441533d296c840de9ddf28471fd246913b902e6862c66dfda1844
7
- data.tar.gz: 4e237b2628166c531857663f7cc245d8b9bf3998d9702325fde9f9a076bc47159894f9b258b2c2328cfb0678fa20c4464f4921d5f674c341f186a0a76c1418d2
6
+ metadata.gz: da91c8d99c4c586ab67812a49f66b2ca286e5695082ff93af37fccf6dc4ecd1071ebb024b6a92e34e03c60247779c76b31047d1225afddaa3223b4b3c5aa18d4
7
+ data.tar.gz: 5440942e4b41d30fe82957254c9ce36bb5cc19be0d7961f757a9e4190349581db698f5d5cd50eb0e390c5c35f668feab7acf4aea584da504335df2c1f4904260
@@ -279,7 +279,7 @@ module Apidae
279
279
  desc: node_value(prestations_hash, :descriptifAnimauxAcceptes, *locales), fee: prestations_hash[:animauxAcceptesSupplement] == 'AVEC_SUPPLEMENT'},
280
280
  extra: apidae_obj.apidae_type == Obj::SPA ? node_value(data_hash, :formuleHebergement, *locales) : node_value(prestations_hash, :complementAccueil, *locales),
281
281
  duration: apidae_obj.apidae_type == Obj::SPA ? {days: data_hash[:nombreJours], nights: data_hash[:nombreNuits]} : data_hash[:dureeSeance],
282
- certifications: data_hash[:agrements].blank? ? [] : data_hash[:agrements].map {|a| {id: a[:type][:id], identifier: a[:numero]}},
282
+ certifications: data_hash[:agrements].blank? ? {} : Hash[data_hash[:agrements].map {|a| [a[:type][:id].to_s, a[:numero]]}],
283
283
  business: (business_hash || {}).except(:sallesEquipeesPour, :sallesEquipement, :sallesRestauration, :sallesReunion, :sallesHebergement),
284
284
  business_equipments: lists_ids((business_hash || {})[:sallesEquipeesPour], (business_hash || {})[:sallesEquipement],
285
285
  (business_hash || {})[:sallesRestauration], (business_hash || {})[:sallesHebergement]),
@@ -40,7 +40,7 @@ module Apidae
40
40
 
41
41
  removed_ids = Obj.where(apidae_id: removed).map {|o| o.id}
42
42
  SelectionObject.where(apidae_selection_id: apidae_sel.id, apidae_object_id: removed_ids).delete_all
43
- if added.any? || removed.any? || (apidae_sel.objects.maximum(:updated_at) > apidae_sel.updated_at)
43
+ if added.any? || removed.any? || (apidae_sel.objects.any? && apidae_sel.objects.maximum(:updated_at) > apidae_sel.updated_at)
44
44
  apidae_sel.touch
45
45
  end
46
46
  end
@@ -0,0 +1,15 @@
1
+ class ChangeObjsCertificationsStructure < ActiveRecord::Migration[6.1]
2
+ def change
3
+ blank_objs = Apidae::Obj.where("type_data->'certifications'->0->>'id' IS NULL")
4
+ set_objs = Apidae::Obj.where("type_data->'certifications'->0->>'id' IS NOT NULL")
5
+
6
+ blank_objs.update_all("type_data = jsonb_set(type_data, '{certifications}', '{}'::jsonb)")
7
+
8
+ set_objs.each do |o|
9
+ unless o.certifications.is_a?(Hash)
10
+ o.certifications = o.certifications.blank? ? {} : Hash[o.certifications.map {|c| [c['id'].to_s, c['identifier']]}]
11
+ o.save!
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Apidae
2
- VERSION = "1.4.15"
2
+ VERSION = "1.4.16"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apidae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.15
4
+ version: 1.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Baptiste Vilain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-24 00:00:00.000000000 Z
11
+ date: 2025-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -192,6 +192,7 @@ files:
192
192
  - db/migrate/20201112080847_create_apidae_territories.rb
193
193
  - db/migrate/20210607214647_add_apidae_type_to_apidae_territories.rb
194
194
  - db/migrate/20230206113335_add_prev_data_to_apidae_objs.rb
195
+ - db/migrate/20250323201235_change_objs_certifications_structure.rb
195
196
  - lib/apidae.rb
196
197
  - lib/apidae/engine.rb
197
198
  - lib/apidae/version.rb