apidae 2.0.2 → 2.0.4
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 +4 -4
- data/app/models/apidae/apidae_data_parser.rb +1 -1
- data/app/models/apidae/export.rb +1 -1
- data/app/models/apidae/obj.rb +12 -4
- data/app/models/apidae/selection.rb +1 -1
- data/config/initializers/search.rb +1 -0
- data/db/migrate/20250318152322_alter_tsv_column_in_pg_search_documents.rb +23 -0
- data/db/migrate/20250323184827_change_obj_certifications_structure.rb +15 -0
- data/lib/apidae/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d7250dcfff0787e618e6dfd622239e656dfc89620fa6e482397b5c0ca489c3f
|
4
|
+
data.tar.gz: 74b5569f9eec506676deb9d6fca8f91c156dc2fafb33b1d2dcdf3846f796213f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2009270aa0638681c64c38d27a4d6489e2186246e1fed3d0da53897bd50197e6837d54ae765d9a705ecb74ef7e376ed4c57785a6ed278b1ac440d97e6396b2e
|
7
|
+
data.tar.gz: a3ef10a3864e4e9e974d9905bfb7715c21144bd3ce2f2c852f7a86ca1d5c2692b8b486edc746fd9fd555245a56ff4c6cd0d8798ad231381791c2a4358bbfc2b1
|
@@ -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? ?
|
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]),
|
data/app/models/apidae/export.rb
CHANGED
data/app/models/apidae/obj.rb
CHANGED
@@ -3,7 +3,7 @@ require 'pg_search'
|
|
3
3
|
module Apidae
|
4
4
|
class Obj < ActiveRecord::Base
|
5
5
|
include PgSearch::Model
|
6
|
-
multisearchable against: [:
|
6
|
+
multisearchable against: [:w_title, :w_town, :w_short_desc, :w_criteria],
|
7
7
|
additional_attributes: -> (o) { { searchable_fields: o.searchable_fields } }
|
8
8
|
|
9
9
|
belongs_to :town, class_name: 'Apidae::Town', foreign_key: :town_insee_code, primary_key: :insee_code, optional: true
|
@@ -144,11 +144,19 @@ module Apidae
|
|
144
144
|
self
|
145
145
|
end
|
146
146
|
|
147
|
-
def
|
148
|
-
|
147
|
+
def w_title
|
148
|
+
title
|
149
149
|
end
|
150
150
|
|
151
|
-
def
|
151
|
+
def w_town
|
152
|
+
"#{town&.name}§§§"
|
153
|
+
end
|
154
|
+
|
155
|
+
def w_short_desc
|
156
|
+
"#{short_desc}§§§"
|
157
|
+
end
|
158
|
+
|
159
|
+
def w_criteria
|
152
160
|
([SUBTYPES.dig(apidae_subtype&.to_i, :label)] + ref_search(payment_methods, PAYMENT) +
|
153
161
|
ref_search(categories, CATEGORIES) + ref_search(themes, THEMES) + ref_search(labels, LABELS) +
|
154
162
|
ref_search(chains, CHAINS) + ref_search(classification, CLASSIFICATION) + ref_search(services, SERVICES) +
|
@@ -224,7 +224,7 @@ module Apidae
|
|
224
224
|
response = ''
|
225
225
|
query = JSON.generate args.except(:url)
|
226
226
|
logger.debug "Apidae API query : #{args[:url]}?query=#{query}"
|
227
|
-
open("#{args[:url]}?query=#{CGI.escape query}") { |f|
|
227
|
+
URI.open("#{args[:url]}?query=#{CGI.escape query}") { |f|
|
228
228
|
f.each_line {|line| response += line if line}
|
229
229
|
}
|
230
230
|
response
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class AlterTsvColumnInPgSearchDocuments < ActiveRecord::Migration[7.2]
|
2
|
+
def up
|
3
|
+
execute <<-SQL
|
4
|
+
ALTER TABLE pg_search_documents DROP COLUMN IF EXISTS tsv_content;
|
5
|
+
ADD COLUMN tsv_content tsvector GENERATED ALWAYS AS (
|
6
|
+
setweight(to_tsvector('fr', coalesce(split_part(coalesce(content, ''), '§§§', 1), '')), 'A') ||
|
7
|
+
setweight(to_tsvector('fr', coalesce(split_part(coalesce(content, ''), '§§§', 2), '')), 'B') ||
|
8
|
+
setweight(to_tsvector('fr', coalesce(split_part(coalesce(content, ''), '§§§', 3), '')), 'C') ||
|
9
|
+
setweight(to_tsvector('fr', coalesce(split_part(coalesce(content, ''), '§§§', 4), '')), 'D') ||
|
10
|
+
) STORED;
|
11
|
+
SQL
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
execute <<-SQL
|
16
|
+
ALTER TABLE pg_search_documents DROP COLUMN IF EXISTS tsv_content;
|
17
|
+
ALTER TABLE pg_search_documents
|
18
|
+
ADD COLUMN tsv_content tsvector GENERATED ALWAYS AS (
|
19
|
+
to_tsvector('fr', coalesce(content, ''))
|
20
|
+
) STORED;
|
21
|
+
SQL
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ChangeObjCertificationsStructure < ActiveRecord::Migration[7.2]
|
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
|
data/lib/apidae/version.rb
CHANGED
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: 2.0.
|
4
|
+
version: 2.0.4
|
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-
|
11
|
+
date: 2025-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -212,6 +212,8 @@ files:
|
|
212
212
|
- db/migrate/20250130110941_add_columns_to_pg_search_documents.rb
|
213
213
|
- db/migrate/20250130120941_add_tsv_column_to_pg_search_documents.rb
|
214
214
|
- db/migrate/20250130152441_add_gin_index_to_pg_search_documents.rb
|
215
|
+
- db/migrate/20250318152322_alter_tsv_column_in_pg_search_documents.rb
|
216
|
+
- db/migrate/20250323184827_change_obj_certifications_structure.rb
|
215
217
|
- lib/apidae.rb
|
216
218
|
- lib/apidae/engine.rb
|
217
219
|
- lib/apidae/version.rb
|