xsys 0.6.1 → 0.6.2

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
  SHA1:
3
- metadata.gz: 7161e2b8cb4040d79ec65f1ce81a753cbafbdf6f
4
- data.tar.gz: 162ef4b6dad1182863dc7d0041f111137fe033ba
3
+ metadata.gz: cd364aa2e5cb7fcd974198879cb7ad2d9be8c64d
4
+ data.tar.gz: c2502fa76e91033154a332cd3b2393488fe6504c
5
5
  SHA512:
6
- metadata.gz: 81da1bd288983c6168f0267f9f802d9ade041e0248961fd7ba439fd6b21d78d948bb30e760b5cf4a26bbb86d8f6163172e838575f813024aa68f288055504591
7
- data.tar.gz: b50e5dbcd5fe9b7768cec6d75bc6ac25572e73709863307958be5504d582c04a6ff1cdb93127a78f738d8176e26516394fe518530e048da991135c234ba5a7c3
6
+ metadata.gz: 3655bc63371d03bf0bbf2e1547393891c84ac73ab94198cfaef166332b8314f14c04316181fc553ef788f858f674243d154d93d9d751bd32477eb52b2cfe2aa9
7
+ data.tar.gz: 605fb8b8c0706a52f268d77463767f808a050c63da6281caa90f90e0f38fb4e3d848f72c0a54ea9057a9420a29f0329a2d5ae66478e911d35fc300db994ef449
data/CHANGELOG.md CHANGED
@@ -217,3 +217,7 @@
217
217
  ## v0.6.1
218
218
 
219
219
  * Fixed default url
220
+
221
+ ## v0.6.2
222
+
223
+ * Added param to skip exhibition on sellable stocks quantity
@@ -39,8 +39,25 @@ module Xsys
39
39
  }
40
40
  end
41
41
 
42
- def sellable_stocks_quantity
43
- sellable_stocks.map(&:quantity).sum
42
+ def sellable_stocks_quantity(options={})
43
+ result = 0
44
+ online_shop_codes = ['OL']
45
+
46
+ sellable_stocks.each do |stock|
47
+ if options[:skip_exhibition]
48
+ if online_shop_codes.include?(stock.shop_code)
49
+ result += stock.quantity
50
+ elsif stock.quantity > 0
51
+ result += (stock.quantity - 1)
52
+ else
53
+ result += stock.quantity
54
+ end
55
+ else
56
+ result += stock.quantity
57
+ end
58
+ end
59
+
60
+ result
44
61
  end
45
62
 
46
63
  def service_stocks
data/lib/xsys/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xsys
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xsys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-28 00:00:00.000000000 Z
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler