bpm_manager 0.9.10 → 0.9.12

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: 8c61895e4bada0ee5102c2d9c506421f32b1121a
4
- data.tar.gz: bb1585e4cb189df3c8c570195ca0f081ca7ada5e
3
+ metadata.gz: 7c7da5c736b1f636f350b7140e10af65bdf9b60f
4
+ data.tar.gz: 6ec59d7dad432a45a9f2133224f822afb49a6976
5
5
  SHA512:
6
- metadata.gz: 606831ca1c306ba5e2d07ee14eaac10bc8b493c814002bdd90f1dd440dd40f30fec554150e6701355c92ac12344498342c21009fbaab481cce58a1345a678a15
7
- data.tar.gz: ec135ee4c4bed56e3ed9044aea87e116d0c19c0744f88a11aba6cbac19f7c3c1b3f9df2d23169369665012f8d3c6b5107e542e2835e58db557b05a004ec87aa9
6
+ metadata.gz: ee7ade62ce2ed0377ad696564a8e8a13cd6d2e01e10206fec449af1166482f84137e639d1e3420aa9ef228d193957efd94964467d5c22e5e464b0a56f66e70fe
7
+ data.tar.gz: 631948cc229a6ebe8df077b8a19807bfa84470039b5c713d0bb6ef01653b4b9ead6336fc4c7ff403e6115a04e6be3a9fbdf0991975893e0f54e7fe88a500fd29
@@ -147,8 +147,18 @@ module BpmManager
147
147
 
148
148
  # Private class methods
149
149
  def self.calculate_sla(start, sla_hours = 0.0, offset = 20)
150
- sla_hours = sla_hours.to_f * 3600 # converts to seconds
151
- sla_hours > 0 ? Time.at((start.utc + sla_hours).to_f * ((100 - offset) / 100)) >= Time.now.utc ? 0 : (start.utc + sla_hours >= Time.now.utc ? 1 : 2) : 0
150
+ # Converts to seconds and calculates warning offset
151
+ sla_hours = sla_hours.to_f * 3600 * ((100 - offset) / 100)
152
+
153
+ if sla_hours > 0
154
+ if start.utc + sla_hours >= Time.now.utc
155
+ 0
156
+ else
157
+ start.utc + sla_hours >= Time.now.utc ? 1 : 2
158
+ end
159
+ else
160
+ 0
161
+ end
152
162
  end
153
163
  private_class_method :calculate_sla
154
164
 
@@ -157,7 +167,7 @@ module BpmManager
157
167
  percent = OpenStruct.new
158
168
  total = (Time.now.utc - start.utc).to_f
159
169
 
160
- percent.green = sla_hours > 0 ? ((start.utc + sla_hours).to_f * (100 - offset) / 100) * 100 / total : 100
170
+ percent.green = sla_hours > 0 ? ((start.utc + (sla_hours * (100 - offset) / 100)).to_f) * 100 / total : 100
161
171
  percent.yellow = sla_hours > 0 ? ((start.utc + sla_hours).to_f * 100 / total) - percent.green : 0
162
172
  percent.red = sla_hours > 0 ? 100 - percent.yellow - percent.green : 0
163
173
 
@@ -1,3 +1,3 @@
1
1
  module BpmManager
2
- VERSION = "0.9.10"
2
+ VERSION = "0.9.12"
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.9.10
4
+ version: 0.9.12
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-02-24 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client