dolar-bna 1.2.5 → 1.2.5.1

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: 02242b5a3c76e60de04841f3bacd3d61663df1e4ef46ee2f814cefd9786cbda8
4
- data.tar.gz: 515ce9858b121266e0e9c4148c550d21e562e5945b386c962e3b6332f64141a9
3
+ metadata.gz: 9b2967be9be678555da83cae839848b941e967b15cec9999e8cc594186fc035a
4
+ data.tar.gz: 55c0a03df7284b7f2179d76fc4f27a04274a5250ee5e329f4a59806126e1051e
5
5
  SHA512:
6
- metadata.gz: d2929210f18902108d4003e371c5628785769596c1d5347584b17301103d6f7e803d45d913a1d3b4d4bb529e4918266a5624b2d165d5910d7aeeee7fbf573ce2
7
- data.tar.gz: 2ba4e95572a52fd78966d5c5e873c996cbee96ab3ae59c8cba1be2ff8900ad2798b32c75e49265c33d4588a11b081ed1cd0499a93184be72c04b885624802455
6
+ metadata.gz: ac383946adf1a573f3764088dda0347f0eb742aaafcf38d8613418129abdb0dbeb9c18cd23ac387cb67cde61cdbab733b35ac402990ff7363cf0ad1ca34b1a41
7
+ data.tar.gz: 10cbbc2c1fed12b0fc2af7ec2d52a06aa4cecb806b59447e838f51f9a5b2c232f4c8fb7954cb1f8e024abcd7b6f800c0b4f58e1192c82e93a6eea07149f880f6
@@ -13,7 +13,7 @@ module Dolar
13
13
 
14
14
  validates_inclusion_of :dolar_type, in: DOLAR_TYPES, message: 'Tipo de cotización inválido'
15
15
 
16
- after_save :set_dolar_agro, if: :dolar_mep?
16
+ after_save :set_dolar_agro, if: :dolar_agro_changer?
17
17
 
18
18
  def self.search_by_date_range search
19
19
  unless search.blank?
@@ -41,12 +41,12 @@ module Dolar
41
41
  end
42
42
  end
43
43
 
44
- def dolar_mep?
45
- dolar_type == "MEP"
44
+ def dolar_agro_changer?
45
+ dolar_type == 'MEP' || dolar_type == 'Divisa'
46
46
  end
47
47
 
48
48
  def set_dolar_agro
49
- divisa_value = Dolar::Bna::DolarCotization.where(dolar_type: 'Divisa', date: self.date).order(date: :asc, created_at: :asc).last
49
+ divisa_value = Dolar::Bna::DolarCotization.where(dolar_type: dolar_type == 'MEP' ? 'Divisa' : 'MEP', date: self.date).order(date: :asc, created_at: :asc).last
50
50
  if divisa_value
51
51
  dolar_buy_average = ((self.dolar_buy.to_f * 0.2) + (divisa_value.dolar_buy.to_f * 0.8)).round(2)
52
52
  dolar_sell_average = ((self.dolar_sell.to_f * 0.2) + (divisa_value.dolar_sell.to_f * 0.8)).round(2)
@@ -1,5 +1,5 @@
1
1
  module Dolar
2
2
  module Bna
3
- VERSION = "1.2.5"
3
+ VERSION = "1.2.5.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dolar-bna
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - LITECODE