bpm_manager 0.9.6 → 0.9.7

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: 4d8294133359fe4d3f79b7d8df035fae01f9013f
4
- data.tar.gz: 804193e23a7f56559ad8e72c930d26a277919142
3
+ metadata.gz: 32df44da9683da124d48f2e91ddc01a29a063879
4
+ data.tar.gz: 0db0e19a356e36f03f1cc8a2ee43d600a32f6d18
5
5
  SHA512:
6
- metadata.gz: d956f349b2608cb98465a343f44aebd0389e83a8bde7ae85bf1d49131a69e883369dd7f7f5b3d91e22889f2d84a35d68d5b8bdb6bee3756436ea0f46a2e2d417
7
- data.tar.gz: bfee484819d942bde6b09e6cbcbe3cc6d8803487de5e86aa735e824cb1aeca00cc5b7bcfd3123eacdccf38dfca18268e9468bd25c620de8f8de10ae0f482ae21
6
+ metadata.gz: 5650cdb0ebf13ac4b5bfb05cf12ddf03f442561f7f9572bd51cc0b5786aaf4c95590772de799312226b49b721504de229b48e5bfe1f1fd875295e6be498cd6e9
7
+ data.tar.gz: e876beb1fcf85e101a119cb986ef5b1f4e9d6c6c7fa9081462f660ed0430333965f35f81142f130a20efd6ce35a74d92eaf8053b05e64baef5e847198fac6466
@@ -146,22 +146,21 @@ module BpmManager
146
146
  end
147
147
 
148
148
  # Private class methods
149
- def self.calculate_sla(start, sla_hours=0, offset=20)
150
- unless sla_hours > 0
151
- (start.to_f + ((sla_hours.to_f * 7*24*60*60))*((100-offset)/100)) <= Time.now.utc.to_f ? 0 : ((start.to_f + (sla_hours.to_f * 7*24*60*60) <= Time.now.utc.to_f) ? 1 : 2)
152
- else
153
- 0
154
- end
149
+ def self.calculate_sla(start, sla_hours = 0.0, offset = 20)
150
+ sla_hours = sla_hours.to_f * 3600 # converts to seconds
151
+
152
+ sla_hours > 0 ? (start.to_f + sla_hours) * ((100 - offset) / 100) <= Time.now.utc.to_f ? 0 : (start.to_f + sla_hours <= Time.now.utc.to_f ? 1 : 2) : 0
155
153
  end
156
154
  private_class_method :calculate_sla
157
155
 
158
156
  def self.calculate_sla_percent(start, sla_hours=0, offset=20)
157
+ sla_hours = sla_hours.to_f * 3600 # converts to seconds
159
158
  percent = OpenStruct.new
160
159
  total = Time.now.utc.to_f - start.to_f
161
160
 
162
- percent.green = sla_hours > 0 ? (start.to_f + ((sla_hours.to_f * 7*24*60*60)) * ((100-offset)/100)) / total * 100 : 100
163
- percent.yellow = sla_hours > 0 ? (start.to_f + ((sla_hours.to_f * 7*24*60*60)) / total * 100) - percent.green : 0
164
- percent.red = sla_hours > 0 ? 100 - percent.yellow - percent.green : 0
161
+ percent.green = sla_hours > 0 ? ((start.to_f + sla_hours) * (100 - offset) / 100) * 100 / total : 100
162
+ percent.yellow = sla_hours > 0 ? ((start.to_f + sla_hours) * 100 / total) - percent.green : 0
163
+ percent.red = sla_hours > 0 ? 100 - percent.yellow - percent.green : 0
165
164
 
166
165
  return percent
167
166
  end
@@ -1,3 +1,3 @@
1
1
  module BpmManager
2
- VERSION = "0.9.6"
2
+ VERSION = "0.9.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bpm_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Presa