bpm_manager 0.9.8 → 0.9.9

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: 622fff9c4c04954799ef7c8f3ddf1803d7a000e8
4
- data.tar.gz: deec1eefb19be045200bfc3936b5bde59ef3cc44
3
+ metadata.gz: f7f876541b39e60726f2644add52fa577b12028d
4
+ data.tar.gz: 096681dcbc632614fb2effe487c0f135143f0098
5
5
  SHA512:
6
- metadata.gz: 2744792511bc0734d427abe0a235ce4836d6ab666b17de00e241cebcc65ad5d5f03df013e10d1345fa1e144e1e8b7567ebb272557d5183790a3b21821a7ba45a
7
- data.tar.gz: 2b23b86efe59884ecf7e3a996003ba6fbe3a6258cae0007bbed0d525d1e389d602235b51bf6566a21a3e2c2564dfb1db1388d954a03dcc2eb0d6495e3eab5f9d
6
+ metadata.gz: 612ceebb30f46fc50ffb6f2f45f0ffd19d28bc6b9c723ed70ce377260ed50f203b2ac6792e5680e3c022987b4d8c3f0bffa2f886a75220ebbb699a4b8f1a9bdc
7
+ data.tar.gz: dd91fa634f1a5ca1265cdced29443e30bed2eb0443b8745f932139f78f3310bda563b2a263b970d515fe664bf1b03c12c1e0e0a266d5a65732e59650374df8bd
@@ -148,18 +148,17 @@ module BpmManager
148
148
  # Private class methods
149
149
  def self.calculate_sla(start, sla_hours = 0.0, offset = 20)
150
150
  sla_hours = sla_hours.to_f * 3600 # converts to seconds
151
-
152
- sla_hours > 0 ? (start + sla_hours) * ((100 - offset) / 100) <= Time.now.utc ? 0 : (start + sla_hours <= Time.now.utc ? 1 : 2) : 0
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
153
152
  end
154
153
  private_class_method :calculate_sla
155
154
 
156
155
  def self.calculate_sla_percent(start, sla_hours=0, offset=20)
157
156
  sla_hours = sla_hours.to_f * 3600 # converts to seconds
158
157
  percent = OpenStruct.new
159
- total = Time.now.utc - start
158
+ total = Time.now.utc - start.utc
160
159
 
161
- percent.green = sla_hours > 0 ? ((start + sla_hours) * (100 - offset) / 100) * 100 / total : 100
162
- percent.yellow = sla_hours > 0 ? ((start + sla_hours) * 100 / total) - percent.green : 0
160
+ percent.green = sla_hours > 0 ? ((start.utc + sla_hours).to_f * (100 - offset) / 100) * 100 / total : 100
161
+ percent.yellow = sla_hours > 0 ? ((start.utc + sla_hours).to_f * 100 / total) - percent.green : 0
163
162
  percent.red = sla_hours > 0 ? 100 - percent.yellow - percent.green : 0
164
163
 
165
164
  return percent
@@ -1,3 +1,3 @@
1
1
  module BpmManager
2
- VERSION = "0.9.8"
2
+ VERSION = "0.9.9"
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.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Presa