bpm_manager 0.9.2 → 0.9.3

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: 96799d8871d846b9ea01b32e0aba3f672b8f44e3
4
- data.tar.gz: 3435d5d53cc227dcb2c6e4c18aad543f059c5a6b
3
+ metadata.gz: ca6203af6d88f9c3a5259a336d30eeff87365c0d
4
+ data.tar.gz: 7fa8319f2a329a531dbcee3efb425f765e2e3f3e
5
5
  SHA512:
6
- metadata.gz: cb652a2e8b5e296f5dddf6f909162378084e8151edfb45f2ea0e6a61585b7900a726f561add9fa6e8611326b96df512145431ae986b529d5cafd3738a2a84d5b
7
- data.tar.gz: f2044662fcc92f4683aca25d802a7836af7492750891c4e9c018d37ae087f2ecf1add6a8dcd468686e8af7f4b94d160ae6505fe664880dd9dcfbc18700d0512c
6
+ metadata.gz: bdb4cae15cdd26269654fb54e61a76a77224c26cfd474c702a1ced7db66090b99ef8c5a6d48cf796d40efc5d55da447c02742996e912f13a2d02457731162dc9
7
+ data.tar.gz: 80c11efb85f5d6502a52655de09572fdcd44d006d0a97b3a6b22831c5eb50f1c232a40de971b99c527720fdd71073b778f758d744f0785252d3dc064101cbca1
@@ -145,6 +145,28 @@ module BpmManager
145
145
  return sla
146
146
  end
147
147
 
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
155
+ end
156
+ private_class_method :calculate_sla
157
+
158
+ def self.calculate_sla_percent(start, sla_hours=0, offset=20)
159
+ percent = OpenStruct.new
160
+ total = Time.now.utf.to_f - start.to_f
161
+
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) - green : 0
164
+ percent.red = sla_hours > 0 ? 100 - yellow - green : 0
165
+
166
+ return percent
167
+ end
168
+ private_class_method :calculate_sla_percent
169
+
148
170
  private
149
171
  def self.structure_task_data(input)
150
172
  tasks = []
@@ -181,24 +203,5 @@ module BpmManager
181
203
 
182
204
  return tasks
183
205
  end
184
-
185
- def calculate_sla(start, sla_hours=0, offset=20)
186
- unless sla_hours > 0
187
- (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)
188
- else
189
- 0
190
- end
191
- end
192
-
193
- def calculate_sla_percent(start, sla_hours=0, offset=20)
194
- percent = OpenStruct.new
195
- total = Time.now.utf.to_f - start.to_f
196
-
197
- percent.green = sla_hours > 0 ? (start.to_f + ((sla_hours.to_f * 7*24*60*60)) * ((100-offset)/100)) / total * 100 : 100
198
- percent.yellow = sla_hours > 0 ? (start.to_f + ((sla_hours.to_f * 7*24*60*60)) / total * 100) - green : 0
199
- percent.red = sla_hours > 0 ? 100 - yellow - green : 0
200
-
201
- return percent
202
- end
203
206
  end
204
207
  end
@@ -1,3 +1,3 @@
1
1
  module BpmManager
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
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.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Presa