c80_shared 0.1.81 → 0.1.82
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/services/sale/inquiry_asked_prices_save_service.rb +37 -0
- data/lib/c80_shared/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 470495c4f0ffeef28e8688ece6570394370701814a2486e79b2d549e0492d6db
|
4
|
+
data.tar.gz: bc93a08acb019183db21203a3a74772f7a5f03613fdd07694b3edeb340c4669b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac04d4304a46223e4231de740a726b40ece52d749b2b119ec2f79bac0ba5fcdc7b632bb000df98bd673ce54a278a0809baa2279ba0a0748454966f2be48c333e
|
7
|
+
data.tar.gz: 82d81a7fb16e5bcd7d2785307785655b7b5443b724c9c18b8c2d95914c3c664c7d4f4b8d721d7ea7121a550bfac9c734b42f365b21bf910e581e31fc5778e2b4
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Sale
|
2
|
+
#
|
3
|
+
# Когда юзер предлагает свою цену продажи лодки (создаётся заявка),
|
4
|
+
# создается набор цен в разных валютах, подвязанных к созданной заявке.
|
5
|
+
#
|
6
|
+
class InquiryAskedPricesSaveService < ::AbstractPricesService
|
7
|
+
def self.perform(sale_inquiry_id, asked_price)
|
8
|
+
new.perform sale_inquiry_id, asked_price
|
9
|
+
end
|
10
|
+
|
11
|
+
def perform(sale_inquiry_id, asked_price = nil)
|
12
|
+
_reset_ivars
|
13
|
+
return false if asked_price.nil?
|
14
|
+
|
15
|
+
ap = asked_price.dup
|
16
|
+
ap[:inquiry_id] = sale_inquiry_id
|
17
|
+
ap[:is_orig] = true
|
18
|
+
ap[:value] = ap[:value].is_a?(String) ? ap[:value].split(/[, ]/).join : ap[:value].to_i # с формы может прийти строка, сгруппированная по разрадям, вида "100,100,222" + тут же превращаем nil в 0
|
19
|
+
ap[:created_at] = '\'%s\'' % Time.now.to_s(:db)
|
20
|
+
_build_other ap
|
21
|
+
|
22
|
+
filtered2 = @built_prices + [ap]
|
23
|
+
_save filtered2
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def _model
|
30
|
+
Sale::InquiryAskedPrice
|
31
|
+
end
|
32
|
+
|
33
|
+
def _fields_for_create
|
34
|
+
@fields_for_create ||= %w'inquiry_id currency_id value is_orig created_at'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
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.82
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- app/services/dimension_service.rb
|
111
111
|
- app/services/lease/create_broadcast_inquiry_service.rb
|
112
112
|
- app/services/lease/find_suits_service.rb
|
113
|
+
- app/services/sale/inquiry_asked_prices_save_service.rb
|
113
114
|
- app/services/users/find_or_generate_email_token_service.rb
|
114
115
|
- app/services/users/generate_email_token_service.rb
|
115
116
|
- bin/console
|