bpm_manager 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bd20d32447d3f004ed4b68d85be370981b2b43c
4
- data.tar.gz: dcab2e8e810a2c815bd75a001ebc76dc1389890c
3
+ metadata.gz: 812dcaf2fee09beb883986496440fb7607269789
4
+ data.tar.gz: e844a51c8f7f1ecf2c9550c5ad2d1c225dd5fdd9
5
5
  SHA512:
6
- metadata.gz: 6ee1f61de34d63d0b4369f0d8ddd3cc9a020b63b071b946e84b86642755fe31ad05d89316aead3a9bbba18fcddf087e69d425ed6a5fc23a20c89e1ad473eb3a2
7
- data.tar.gz: 90ef1c0427b3fc1d7d79c72106f949f212c45943791de20142963a61b523307998b2668cb0a6107a358f10e63af0fa8daf138a4c49911c52c486ce520957dbb0
6
+ metadata.gz: 6a50d275053fcbef61c8ac5ab7fd6b6d2ad2aa38a64531957f35afcb15c4e5e2159a0e1291ecb8d01baaaf730cc3257a8382ef8c2b3816c059da5fc3dc980eb5
7
+ data.tar.gz: 75a82a3854f394792afee073451f40b34ee8ce220233166cf58a498c7bf0b57017210144f4750230a55f8469641dc819c03399f2efd1c068381ff39c3ffd840e
@@ -147,12 +147,12 @@ module BpmManager
147
147
 
148
148
  # Private class methods
149
149
  def self.calculate_sla(start, sla_hours = 0.0, offset = 20)
150
- # Converts to seconds and calculates warning offset
151
- sla_hours_ok = sla_hours.to_f * 3600
152
- sla_hours_warn = sla_hours_ok * ((100 - offset) / 100)
150
+ hours = sla_hours.to_f * 3600 # Converts to seconds and calculates warning offset
151
+ warn = start.utc + hours * ((100.0 - offset) / 100)
152
+ total = start.utc + hours
153
153
 
154
154
  # Returns the status
155
- sla_hours > 0 ? (start.utc + sla_hours_warn >= Time.now.utc ? (start.utc + sla_hours_ok >= Time.now.utc ? 0 : 1) : 2) : 0
155
+ Time.now.utc <= warn ? 0 : ( warn < Time.now.utc && Time.now.utc <= total ? 1 : 2 )
156
156
  end
157
157
  private_class_method :calculate_sla
158
158
 
@@ -1,3 +1,3 @@
1
1
  module BpmManager
2
- VERSION = "0.10.0"
2
+ VERSION = "0.10.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bpm_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Presa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-02 00:00:00.000000000 Z
11
+ date: 2016-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client