apidae 1.4.15 → 1.4.17

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: 2f95b9e7fa42cf5b6e8726526abf2c8dbaef2d903d81d8b114e38879af1fe0ee
4
+ data.tar.gz: fc0423dd7cb323027a25f1320ccb30a934c1b0788ae29f5cf060d28992ce6a1f
5
5
  SHA512:
6
- metadata.gz: 5fae148c4eec799645b90c2be7dc211d76211e4a516ab4cbe960d6e436b501462b792670058441533d296c840de9ddf28471fd246913b902e6862c66dfda1844
7
- data.tar.gz: 4e237b2628166c531857663f7cc245d8b9bf3998d9702325fde9f9a076bc47159894f9b258b2c2328cfb0678fa20c4464f4921d5f674c341f186a0a76c1418d2
6
+ metadata.gz: 22ab57e4a74563557f764b757ad3914de05ccae6a3ee346e7e47cf9bf0d247280267c965e820a8b8f78e1bc07c625b5b90beabf7c9ad7e91133b004fedb1073b
7
+ data.tar.gz: 11211dbdb0423e2b251c45fbee439bade36a9036f1741ebbe56145baf5056fc2d8e1637a81b2a3676d75d40d44e2e01cf9624c0068ff088131d81f7445ab3008
@@ -270,6 +270,17 @@ module Apidae
270
270
  labels: lists_ids(data_hash[:labels], data_hash[:labelsChartesQualite], prestations_hash[:labelsTourismeHandicap]) +
271
271
  (node_id(data_hash, :typeLabel) ? [node_id(data_hash, :typeLabel)] : []),
272
272
  chains: lists_ids(data_hash[:chaines]) + nodes_ids(data_hash[:chaineEtLabel]),
273
+ ratings: (lists_ids(data_hash[:labels]).map {|label_id| {id: label_id, type: 'labels'}} +
274
+ lists_ids(data_hash[:labelsChartesQualite]).map {|label_id| {id: label_id, type: 'labelsChartesQualite'}} +
275
+ lists_ids(prestations_hash[:labelsTourismeHandicap]).map {|label_id| {id: label_id, type: 'labelsTourismeHandicap'}} +
276
+ nodes_ids(data_hash[:typeLabel]).map {|label_id| {id: label_id, type: 'typeLabel', ref: data_hash[:numeroAgrementLabel], start_date: data_hash[:dateAgrementLabel]}} +
277
+ lists_ids(data_hash[:chaines]).map {|ch_id| {id: ch_id, type: 'chaines'}} +
278
+ nodes_ids(data_hash[:chaineEtLabel]).map {|ch_id| {id: ch_id, type: 'chaineEtLabel'}} +
279
+ nodes_ids(data_hash[:classement]).map {|c_id| {id: c_id, type: 'classement', start_date: data_hash[:dateClassement], ref: data_hash[:numeroClassement]}} +
280
+ nodes_ids(data_hash[:classementPrefectoral]).map {|c_id| {id: c_id, type: 'classementPrefectoral', start_date: data_hash[:dateClassement], ref: data_hash[:numeroClassement]}} +
281
+ nodes_ids(data_hash[:classification]).map {|c_id| {id: c_id, type: 'classification'}} +
282
+ lists_ids(data_hash[:classementsGuides]).map {|c_id| {id: c_id, type: 'classementsGuides'}} +
283
+ lists_ids(data_hash[:classements]).map {|c_id| {id: c_id, type: 'classements'}}),
273
284
  area: apidae_obj.apidae_type == Obj::DOS ? data_hash.except(:classification) : node_value(data_hash, :lieuDePratique),
274
285
  track: apidae_obj.apidae_type == Obj::EQU ? (data_hash[:itineraire] || {}).except(:passagesDelicats) : nil,
275
286
  tricky_sections: apidae_obj.apidae_type == Obj::EQU ? node_value(data_hash[:itineraire], :passagesDelicats, *locales) : nil,
@@ -279,7 +290,7 @@ module Apidae
279
290
  desc: node_value(prestations_hash, :descriptifAnimauxAcceptes, *locales), fee: prestations_hash[:animauxAcceptesSupplement] == 'AVEC_SUPPLEMENT'},
280
291
  extra: apidae_obj.apidae_type == Obj::SPA ? node_value(data_hash, :formuleHebergement, *locales) : node_value(prestations_hash, :complementAccueil, *locales),
281
292
  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]}},
293
+ certifications: data_hash[:agrements].blank? ? {} : Hash[data_hash[:agrements].map {|a| [a[:type][:id].to_s, a[:numero]]}],
283
294
  business: (business_hash || {}).except(:sallesEquipeesPour, :sallesEquipement, :sallesRestauration, :sallesReunion, :sallesHebergement),
284
295
  business_equipments: lists_ids((business_hash || {})[:sallesEquipeesPour], (business_hash || {})[:sallesEquipement],
285
296
  (business_hash || {})[:sallesRestauration], (business_hash || {})[:sallesHebergement]),
@@ -15,7 +15,7 @@ module Apidae
15
15
  store_accessor :description_data, :short_desc, :long_desc, :theme_desc, :private_desc, :accessibility_desc
16
16
  store_accessor :pictures_data, :pictures
17
17
  store_accessor :attachments_data, :attachments
18
- store_accessor :type_data, :categories, :themes, :capacity, :classification, :classification_date,
18
+ store_accessor :type_data, :categories, :themes, :capacity, :classification, :classification_date, :ratings,
19
19
  :classification_ref, :labels, :chains, :area, :track, :tricky_sections, :products, :audience, :animals,
20
20
  :animals_desc, :extra, :duration, :certifications, :business, :business_equipments, :business_rooms
21
21
  store_accessor :entity_data, :entity_id, :entity_name, :info_entity_id, :info_entity_name, :service_provider_id,
@@ -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.17"
3
3
  end
@@ -13845,3 +13845,10 @@ Migrating to MigrateLocalizedApidaeObjFields (20190127210921)
13845
13845
  Apidae::Obj Load (2.4ms) SELECT "apidae_objs".* FROM "apidae_objs" WHERE "apidae_objs"."root_obj_id" IS NULL
13846
13846
  TRANSACTION (0.8ms) ROLLBACK
13847
13847
   (0.5ms) SELECT pg_advisory_unlock(6140174353533887940)
13848
+  (0.1ms) SELECT pg_try_advisory_lock(6140174353533887940)
13849
+ ActiveRecord::SchemaMigration Load (1.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
13850
+ ActiveRecord::InternalMetadata Load (2.2ms) SELECT * FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 ORDER BY "ar_internal_metadata"."key" ASC LIMIT 1 [[nil, "environment"]]
13851
+ Migrating to MigrateLocalizedApidaeReferences (20190127213602)
13852
+ TRANSACTION (0.2ms) BEGIN
13853
+ TRANSACTION (0.1ms) ROLLBACK
13854
+  (0.3ms) SELECT pg_advisory_unlock(6140174353533887940)
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.17
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-06-14 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