spree_cm_commissioner 2.5.0.pre.pre15 → 2.5.0.pre.patch.pre.chatrace.pre.dynamic.pre.fields
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee6b7c4bcab82c887ab4de66b278e765b28dbbccd3919afcef66c712cbc94166
|
|
4
|
+
data.tar.gz: bc40094b4cc455d4e68e8279122f2587957aebfab1c6850f818623e97d4be0d4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a347fd73ac60dfb17a5eee4eb24d07e1ab230094fd11718ea6c5ed80338c4b02c46dcb373293ca8b26aa41bdbbe0948af07f6005eb01a43ed5977f19d25ab389
|
|
7
|
+
data.tar.gz: c670437c18ab6b3cb3c9ea65ca78db7b1df9c11f8f137d89d3b06623c6c99e78447467042592ec52c02ebf23f9ac145cdadb4a752fbd1e18d6a2af8820f988ee
|
data/Gemfile.lock
CHANGED
|
@@ -27,32 +27,52 @@ module Spree
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
def serialize_resource(guest)
|
|
31
|
+
guest_auto_payload(guest)
|
|
32
|
+
.merge(default_payload(guest))
|
|
33
|
+
.merge(dynamic_field_key_value(guest))
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
# In API Response eg: "field_17": "chhunlin", "field_18": "on",......
|
|
30
39
|
def dynamic_field_key_value(guest)
|
|
31
40
|
guest.guest_dynamic_fields
|
|
32
41
|
.includes(:dynamic_field)
|
|
33
42
|
.to_h do |gdf|
|
|
34
|
-
|
|
35
|
-
.parameterize
|
|
36
|
-
.underscore
|
|
43
|
+
label = "field_#{gdf.dynamic_field.id}"
|
|
37
44
|
|
|
38
|
-
|
|
45
|
+
value = gdf.value.strip
|
|
46
|
+
|
|
47
|
+
[label, value]
|
|
39
48
|
end
|
|
40
49
|
end
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
EXCLUDED_GUEST_COLUMNS = %w[
|
|
52
|
+
id created_at updated_at occupation_id event_id nationality_id
|
|
53
|
+
preferences upload_later social_contact_platform user_id
|
|
54
|
+
bib_number bib_prefix bib_index public_metadata private_metadata
|
|
55
|
+
seat_number intel_phone_number block_id saved_guest_id
|
|
56
|
+
data_fill_stage_phase
|
|
57
|
+
].freeze
|
|
58
|
+
|
|
59
|
+
def guest_base_columns
|
|
60
|
+
SpreeCmCommissioner::Guest.column_names - EXCLUDED_GUEST_COLUMNS
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def guest_auto_payload(guest)
|
|
64
|
+
guest_base_columns.index_with do |column|
|
|
65
|
+
guest.public_send(column)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def default_payload(guest) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
|
43
70
|
order = guest.line_item.order
|
|
44
71
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
last_name: guest.last_name,
|
|
49
|
-
dob: guest.dob,
|
|
50
|
-
gender: guest.gender,
|
|
51
|
-
age: guest.age,
|
|
72
|
+
{
|
|
73
|
+
guest_nationality: guest.nationality&.name,
|
|
74
|
+
guest_id_card_type: guest.id_card&.card_type,
|
|
52
75
|
occupation: guest.occupation&.name || guest.other_occupation,
|
|
53
|
-
entry_type: guest.entry_type,
|
|
54
|
-
organization: guest.other_organization,
|
|
55
|
-
expectation: guest.expectation,
|
|
56
76
|
telegram_user_id: guest.preferred_telegram_user_id,
|
|
57
77
|
telegram_user_verified_at: guest.preferred_telegram_user_verified_at,
|
|
58
78
|
order_number: order.number,
|
|
@@ -63,13 +83,10 @@ module Spree
|
|
|
63
83
|
checked_in_at: guest.check_in&.confirmed_at,
|
|
64
84
|
qr_data: guest.qr_data,
|
|
65
85
|
order_qr_data: order.qr_data,
|
|
66
|
-
country_code: guest.country_code,
|
|
67
|
-
line_item_id: guest.line_item_id,
|
|
68
86
|
order_token: order.token,
|
|
69
|
-
bib: guest.formatted_bib_number
|
|
87
|
+
bib: guest.formatted_bib_number,
|
|
88
|
+
line_item_option_text: guest.line_item&.options_text
|
|
70
89
|
}
|
|
71
|
-
|
|
72
|
-
base_payload.merge(dynamic_field_key_value(guest))
|
|
73
90
|
end
|
|
74
91
|
end
|
|
75
92
|
end
|
|
@@ -45,7 +45,7 @@ module SpreeCmCommissioner
|
|
|
45
45
|
|
|
46
46
|
accepts_nested_attributes_for :trip_stops, :product, :seat_layout, allow_destroy: true
|
|
47
47
|
|
|
48
|
-
self.whitelisted_ransackable_associations = %w[product vehicle
|
|
48
|
+
self.whitelisted_ransackable_associations = %w[product vehicle]
|
|
49
49
|
self.whitelisted_ransackable_attributes = %w[origin_place_id destination_place_id]
|
|
50
50
|
|
|
51
51
|
def changed_route_attributes?
|
|
@@ -8,8 +8,6 @@ module SpreeCmCommissioner
|
|
|
8
8
|
# The ID is automatically updated whenever the seat_layout is saved.
|
|
9
9
|
store_public_metadata :preload_seat_layout_id, :integer
|
|
10
10
|
|
|
11
|
-
attr_accessor :enable_seat_layout
|
|
12
|
-
|
|
13
11
|
belongs_to :vendor, class_name: 'Spree::Vendor'
|
|
14
12
|
|
|
15
13
|
has_one :primary_photo, -> { order(position: :asc) }, class_name: 'SpreeCmCommissioner::VehiclePhoto', as: :viewable, dependent: :destroy
|
|
@@ -26,9 +24,5 @@ module SpreeCmCommissioner
|
|
|
26
24
|
validates :name, uniqueness: { scope: :vendor_id }, presence: true
|
|
27
25
|
|
|
28
26
|
self.whitelisted_ransackable_attributes = %w[name kind]
|
|
29
|
-
|
|
30
|
-
def seat_layout?
|
|
31
|
-
preload_seat_layout_id.present?
|
|
32
|
-
end
|
|
33
27
|
end
|
|
34
28
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_cm_commissioner
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.5.0.pre.
|
|
4
|
+
version: 2.5.0.pre.patch.pre.chatrace.pre.dynamic.pre.fields
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- You
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: spree
|