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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9aba9bc138f3b398cba5fbe6c0349e592a6a1c606be5d619b8386c1a1e8f6ab5
4
- data.tar.gz: 539f72976529f818e9802fde38abb1a28c8b41de042ad11797a92dae7aa63a0c
3
+ metadata.gz: 470495c4f0ffeef28e8688ece6570394370701814a2486e79b2d549e0492d6db
4
+ data.tar.gz: bc93a08acb019183db21203a3a74772f7a5f03613fdd07694b3edeb340c4669b
5
5
  SHA512:
6
- metadata.gz: 5262575db28181c8cc029d3becd615c4be8e748d810a8a2f4058f8747adfcc2f6b2137c03f337fe465b03966b763c24811bf900496d7d6fb8cda347192ad2f4f
7
- data.tar.gz: 7fb1ef0c995be5dc6aba8c2d2472a66ea83ebb46b368ca05dee270eea0decae492d42339e13a2f8b9ead8dd193f34b012165c6ea6629c4380399b64256e710f5
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
@@ -1,3 +1,3 @@
1
1
  module C80Shared
2
- VERSION = "0.1.81"
2
+ VERSION = "0.1.82"
3
3
  end
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.81
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-01 00:00:00.000000000 Z
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