c80_shared 0.1.15 → 0.1.16
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cde6b4910035f561acdab26049ac39873c785e174d5034c163c16dc62eed9b61
|
4
|
+
data.tar.gz: 899f3df15035dee6aff913d48f649ccf867b2fca941e985b07574d3e9b3cfc28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e03ea2c8a4e2bb41666cdbdfb49055f8cbfb5827ccc05834c693e1f0564f7707a561f3f5d6bfb335d92a791376376c43d2e8878ac09689228af6f2fc68160d4
|
7
|
+
data.tar.gz: 607dae99f944d8ffa3be82ece28befbab975caade25b3d791d2c91b21a8745d0f415355f01b664837883498b58015ab915d2948bb6e49fe084d959a89ff166d7
|
@@ -20,27 +20,35 @@ class BoatSerializer < AbstractSerializer
|
|
20
20
|
boat_type_id
|
21
21
|
builder
|
22
22
|
built_year
|
23
|
+
charter_1_day_high_discount
|
23
24
|
charter_1_day_high_eur
|
24
25
|
charter_1_day_high_rub
|
25
26
|
charter_1_day_high_usd
|
27
|
+
charter_1_day_low_discount
|
26
28
|
charter_1_day_low_eur
|
27
29
|
charter_1_day_low_rub
|
28
30
|
charter_1_day_low_usd
|
31
|
+
charter_1_hour_high_discount
|
29
32
|
charter_1_hour_high_eur
|
30
33
|
charter_1_hour_high_rub
|
31
34
|
charter_1_hour_high_usd
|
35
|
+
charter_1_hour_low_discount
|
32
36
|
charter_1_hour_low_eur
|
33
37
|
charter_1_hour_low_rub
|
34
38
|
charter_1_hour_low_usd
|
39
|
+
charter_1_month_high_discount
|
35
40
|
charter_1_month_high_eur
|
36
41
|
charter_1_month_high_rub
|
37
42
|
charter_1_month_high_usd
|
43
|
+
charter_1_month_low_discount
|
38
44
|
charter_1_month_low_eur
|
39
45
|
charter_1_month_low_rub
|
40
46
|
charter_1_month_low_usd
|
47
|
+
charter_1_week_high_discount
|
41
48
|
charter_1_week_high_eur
|
42
49
|
charter_1_week_high_rub
|
43
50
|
charter_1_week_high_usd
|
51
|
+
charter_1_week_low_discount
|
44
52
|
charter_1_week_low_eur
|
45
53
|
charter_1_week_low_rub
|
46
54
|
charter_1_week_low_usd
|
@@ -63,6 +71,7 @@ class BoatSerializer < AbstractSerializer
|
|
63
71
|
price
|
64
72
|
price_discount
|
65
73
|
refit_year
|
74
|
+
sale_price_discount
|
66
75
|
sale_price_eur
|
67
76
|
sale_price_rub
|
68
77
|
sale_price_usd
|
@@ -111,7 +120,6 @@ class BoatSerializer < AbstractSerializer
|
|
111
120
|
{ name_builder: arr * ' ' }
|
112
121
|
end
|
113
122
|
|
114
|
-
|
115
123
|
# noinspection RubyResolve
|
116
124
|
def picture_medium_url(boat)
|
117
125
|
url = if boat.boat_photo.present?
|
@@ -128,7 +136,7 @@ class BoatSerializer < AbstractSerializer
|
|
128
136
|
end
|
129
137
|
|
130
138
|
def motor(boat)
|
131
|
-
{ motor: boat.motor }
|
139
|
+
{ motor: boat.motor || '' }
|
132
140
|
end
|
133
141
|
|
134
142
|
def main_boat_photo_id(boat)
|
@@ -189,7 +197,7 @@ class BoatSerializer < AbstractSerializer
|
|
189
197
|
end
|
190
198
|
|
191
199
|
def hull_material(boat)
|
192
|
-
{ hull_material: boat.hull_material }
|
200
|
+
{ hull_material: boat.hull_material || '' }
|
193
201
|
end
|
194
202
|
|
195
203
|
def crew_total(boat)
|
@@ -274,10 +282,9 @@ class BoatSerializer < AbstractSerializer
|
|
274
282
|
end
|
275
283
|
|
276
284
|
def boat_hull_id(boat)
|
277
|
-
{ boat_hull_id: boat.boat_hull_id }
|
285
|
+
{ boat_hull_id: boat.boat_hull_id || '' }
|
278
286
|
end
|
279
287
|
|
280
|
-
|
281
288
|
# --[low]-----------------------------------------------------------------------------------------------------------
|
282
289
|
|
283
290
|
def charter_1_hour_low_usd(boat)
|
@@ -392,6 +399,44 @@ class BoatSerializer < AbstractSerializer
|
|
392
399
|
{ sale_price_eur: boat.sale_price_eur || '' }
|
393
400
|
end
|
394
401
|
|
402
|
+
# --[discount]------------------------------------------------------------------------------------------------------
|
403
|
+
|
404
|
+
def charter_1_day_high_discount(boat)
|
405
|
+
{ charter_1_day_high_discount: boat.charter_1_day_high_discount }
|
406
|
+
end
|
407
|
+
|
408
|
+
def charter_1_day_low_discount(boat)
|
409
|
+
{ charter_1_day_low_discount: boat.charter_1_day_low_discount }
|
410
|
+
end
|
411
|
+
|
412
|
+
def charter_1_hour_high_discount(boat)
|
413
|
+
{ charter_1_hour_high_discount: boat.charter_1_hour_high_discount }
|
414
|
+
end
|
415
|
+
|
416
|
+
def charter_1_hour_low_discount(boat)
|
417
|
+
{ charter_1_hour_low_discount: boat.charter_1_hour_low_discount }
|
418
|
+
end
|
419
|
+
|
420
|
+
def charter_1_month_high_discount(boat)
|
421
|
+
{ charter_1_month_high_discount: boat.charter_1_month_high_discount }
|
422
|
+
end
|
423
|
+
|
424
|
+
def charter_1_month_low_discount(boat)
|
425
|
+
{ charter_1_month_low_discount: boat.charter_1_month_low_discount }
|
426
|
+
end
|
427
|
+
|
428
|
+
def charter_1_week_high_discount(boat)
|
429
|
+
{ charter_1_week_high_discount: boat.charter_1_week_high_discount }
|
430
|
+
end
|
431
|
+
|
432
|
+
def charter_1_week_low_discount(boat)
|
433
|
+
{ charter_1_week_low_discount: boat.charter_1_week_low_discount }
|
434
|
+
end
|
435
|
+
|
436
|
+
def sale_price_discount(boat)
|
437
|
+
{ sale_price_discount: boat.sale_price_discount }
|
438
|
+
end
|
439
|
+
|
395
440
|
def state(boat)
|
396
441
|
{ state: boat.state }
|
397
442
|
end
|
@@ -400,6 +445,7 @@ class BoatSerializer < AbstractSerializer
|
|
400
445
|
# FIXME:: выяснить, нужно ли всётаки использовать .gsub('\'', ''') для строк с путями к фоткам?
|
401
446
|
boat_photos = boat.boat_photos.map do |boat_photo|
|
402
447
|
{
|
448
|
+
id: boat_photo.id,
|
403
449
|
gallery_path: boat_photo.picture.url(:gallery),
|
404
450
|
medium_path: boat_photo.picture.url(:medium),
|
405
451
|
thumb_path: boat_photo.picture.url(:thumb)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Configs
|
2
|
+
module Boats
|
3
|
+
class BoatPricesDiscount
|
4
|
+
#
|
5
|
+
# список атрибутов лодки, в которых указана скидка в процентах
|
6
|
+
#
|
7
|
+
def self.attributes(price_attributes = ::Dictionaries::BoatCharterAttribute::ALL)
|
8
|
+
# собираем имена вида: charter_1_hour_high_discount,...
|
9
|
+
attributes = []
|
10
|
+
price_attributes.map do |attr|
|
11
|
+
field = '%s_discount' % attr
|
12
|
+
next unless field
|
13
|
+
|
14
|
+
attributes << field.to_sym
|
15
|
+
end
|
16
|
+
|
17
|
+
# особняком добавляем имя атрибута sale_price_discount
|
18
|
+
field = '%s_discount' % :sale_price
|
19
|
+
attributes << field.to_sym
|
20
|
+
|
21
|
+
if block_given?
|
22
|
+
attributes.each do |attribute|
|
23
|
+
yield attribute
|
24
|
+
end
|
25
|
+
else
|
26
|
+
attributes
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/c80_shared/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c80_shared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- app/serializers/boat_serializer.rb
|
62
62
|
- app/serializers/boat_visit_day_serializer.rb
|
63
63
|
- app/serializers/configs/boats/boat_prices.rb
|
64
|
+
- app/serializers/configs/boats/boat_prices_discount.rb
|
64
65
|
- app/serializers/configs/boats/central_agent/boat_list.rb
|
65
66
|
- app/serializers/configs/lease/central_agent/inquiry_list.rb
|
66
67
|
- app/serializers/lease/bid_serializer.rb
|