bpm_manager 1.0.28 → 1.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bpm_manager/red_hat.rb +80 -81
- data/lib/bpm_manager/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 022aba1cba59e521272deaf42fc6b964035eda9b
|
4
|
+
data.tar.gz: 1a8fe793a457a6e01a377bc7611c9078ed8bfeab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 533bc9a9009fe4a433100097f26b3c70151a5fea0e4c123fc355d4ffd80a71a14bc483915db3afc8806bd79363d2311e2959505e7fad34127a8d4e4b97f58633
|
7
|
+
data.tar.gz: 8e9d00cafdd7544bd2c62b51292f393bcccb9881aedec394cae1b4ca76472dc557af9aab972fbb1dc7ec25368080c2af16280f2538a776593bec6483713a7e45
|
data/lib/bpm_manager/red_hat.rb
CHANGED
@@ -169,14 +169,13 @@ module BpmManager
|
|
169
169
|
|
170
170
|
unless my_process.nil?
|
171
171
|
sla = OpenStruct.new(:process => OpenStruct.new)
|
172
|
-
|
172
|
+
start_time = Time.at(my_process['start']/1000)
|
173
|
+
end_time = my_process['start'].nil? ? Time.now : Time.at(my_process['start']/1000)
|
173
174
|
|
174
175
|
# Calculates the process sla
|
175
|
-
sla.process.status = calculate_sla(
|
176
|
-
sla.process.status_name = (calculate_sla(
|
177
|
-
sla.process.percentages = calculate_sla_percent(
|
178
|
-
else
|
179
|
-
sla = nil
|
176
|
+
sla.process.status = calculate_sla(start_time, end_time, process_sla_hours, warning_offset_percent)
|
177
|
+
sla.process.status_name = (calculate_sla(start_time, end_time, process_sla_hours, warning_offset_percent) == 0) ? 'ok' : (calculate_sla(start_time, end_time, process_sla_hours, warning_offset_percent) == 1 ? 'warning' : 'due')
|
178
|
+
sla.process.percentages = calculate_sla_percent(start_time, end_time, process_sla_hours, warning_offset_percent)
|
180
179
|
end
|
181
180
|
|
182
181
|
return sla
|
@@ -190,47 +189,45 @@ module BpmManager
|
|
190
189
|
sla = OpenStruct.new(:task => OpenStruct.new, :process => OpenStruct.new)
|
191
190
|
|
192
191
|
# Calculates the process sla
|
193
|
-
sla.process.status = calculate_sla(my_task.process.start_on, process_sla_hours, warning_offset_percent)
|
194
|
-
sla.process.status_name = (calculate_sla(my_task.process.start_on, process_sla_hours, warning_offset_percent) == 0) ? 'ok' : (calculate_sla(my_task.process.start_on, process_sla_hours, warning_offset_percent) == 1 ? 'warning' : 'due')
|
195
|
-
sla.process.percentages = calculate_sla_percent(my_task.process.start_on, process_sla_hours, warning_offset_percent)
|
192
|
+
sla.process.status = calculate_sla(my_task.process.start_on, my_task.process.end_on, process_sla_hours, warning_offset_percent)
|
193
|
+
sla.process.status_name = (calculate_sla(my_task.process.start_on, my_task.process.end_on, process_sla_hours, warning_offset_percent) == 0) ? 'ok' : (calculate_sla(my_task.process.start_on, my_task.process.end_on, process_sla_hours, warning_offset_percent) == 1 ? 'warning' : 'due')
|
194
|
+
sla.process.percentages = calculate_sla_percent(my_task.process.start_on, my_task.process.end_on, process_sla_hours, warning_offset_percent)
|
196
195
|
|
197
196
|
# Calculates the task sla
|
198
|
-
sla.task.status = calculate_sla(my_task.created_on, task_sla_hours, warning_offset_percent)
|
199
|
-
sla.task.status_name = (calculate_sla(my_task.created_on, task_sla_hours, warning_offset_percent) == 0) ? 'ok' : (calculate_sla(my_task.created_on, task_sla_hours, warning_offset_percent) == 1 ? 'warning' : 'due')
|
200
|
-
sla.task.percentages = calculate_sla_percent(my_task.created_on, task_sla_hours, warning_offset_percent)
|
201
|
-
else
|
202
|
-
sla = nil
|
197
|
+
sla.task.status = calculate_sla(my_task.created_on, nil, task_sla_hours, warning_offset_percent)
|
198
|
+
sla.task.status_name = (calculate_sla(my_task.created_on, nil, task_sla_hours, warning_offset_percent) == 0) ? 'ok' : (calculate_sla(my_task.created_on, nil, task_sla_hours, warning_offset_percent) == 1 ? 'warning' : 'due')
|
199
|
+
sla.task.percentages = calculate_sla_percent(my_task.created_on, nil, task_sla_hours, warning_offset_percent)
|
203
200
|
end
|
204
201
|
|
205
202
|
return sla
|
206
203
|
end
|
207
204
|
|
208
205
|
# Private class methods
|
209
|
-
def self.calculate_sla(
|
206
|
+
def self.calculate_sla(start_time, end_time = Time.now, sla_hours = 0.0, offset = 20)
|
210
207
|
hours = sla_hours.to_f * 3600 # Converts to seconds and calculates warning offset
|
211
|
-
warn =
|
212
|
-
total =
|
208
|
+
warn = start_time.utc + hours * ((100.0 - offset) / 100)
|
209
|
+
total = start_time.utc + hours
|
213
210
|
|
214
211
|
# Returns the status
|
215
|
-
|
212
|
+
end_time.utc <= warn ? 0 : ( warn < end_time.utc && end_time.utc <= total ? 1 : 2 )
|
216
213
|
end
|
217
214
|
private_class_method :calculate_sla
|
218
215
|
|
219
|
-
def self.calculate_sla_percent(
|
216
|
+
def self.calculate_sla_percent(start_time, end_time = Time.now, sla_hours = 0.0, offset = 20)
|
220
217
|
sla_hours = sla_hours * 3600.0 # converts to seconds
|
221
218
|
offset_pcg = (100.0 - offset) / 100.0
|
222
219
|
percent = OpenStruct.new
|
223
220
|
|
224
221
|
unless sla_hours < 1 # it's zero or negative
|
225
|
-
if
|
226
|
-
total = (
|
222
|
+
if end_time.utc > (start_time.utc + sla_hours) # Ruby Red
|
223
|
+
total = (end_time.utc - start_time.utc).to_f
|
227
224
|
percent.green = (sla_hours * offset_pcg / total * 100).round(2)
|
228
225
|
percent.yellow = ((sla_hours / total * 100) - percent.green).round(2)
|
229
226
|
percent.red = (100 - percent.yellow - percent.green).round(2)
|
230
227
|
else # Still Green
|
231
228
|
total = sla_hours
|
232
|
-
percent.green =
|
233
|
-
percent.yellow =
|
229
|
+
percent.green = end_time.utc <= start_time.utc + total * offset_pcg ? ((100-offset) - (((start_time.utc + total * offset_pcg) - end_time.utc) * 100).to_f / (total * offset_pcg).to_f).round(2) : 100 - offset
|
230
|
+
percent.yellow = end_time.utc <= start_time.utc + total * offset_pcg ? 0.0 : (offset - (start_time.utc + total - end_time.utc).to_f * 100 / (total * offset_pcg).to_f).round(2)
|
234
231
|
percent.red = 0.0
|
235
232
|
end
|
236
233
|
|
@@ -255,37 +252,38 @@ module BpmManager
|
|
255
252
|
unless input['taskSummaryList'].nil? || input['taskSummaryList'].empty?
|
256
253
|
input['taskSummaryList'].each do |task|
|
257
254
|
task_query = self.task_query(task['id'])
|
258
|
-
my_task
|
259
|
-
my_task.id
|
260
|
-
my_task.name
|
261
|
-
my_task.subject
|
262
|
-
my_task.description
|
263
|
-
my_task.status
|
264
|
-
my_task.priority
|
265
|
-
my_task.skippable
|
266
|
-
my_task.created_on
|
267
|
-
my_task.active_on
|
255
|
+
my_task = OpenStruct.new
|
256
|
+
my_task.id = task['id']
|
257
|
+
my_task.name = task['name']
|
258
|
+
my_task.subject = task['subject']
|
259
|
+
my_task.description = task['description']
|
260
|
+
my_task.status = task['status']
|
261
|
+
my_task.priority = task['priority']
|
262
|
+
my_task.skippable = task['skippable']
|
263
|
+
my_task.created_on = Time.at(task['created-on']/1000)
|
264
|
+
my_task.active_on = Time.at(task['activation-time']/1000)
|
268
265
|
my_task.process_instance_id = task['process-instance-id']
|
269
|
-
my_task.process_id
|
270
|
-
my_task.process_session_id
|
271
|
-
my_task.deployment_id
|
272
|
-
my_task.quick_task_summary
|
273
|
-
my_task.parent_id
|
274
|
-
my_task.form_name
|
275
|
-
my_task.creator
|
276
|
-
my_task.owner
|
277
|
-
my_task.data
|
266
|
+
my_task.process_id = task['process-id']
|
267
|
+
my_task.process_session_id = task['process-session-id']
|
268
|
+
my_task.deployment_id = task['deployment-id']
|
269
|
+
my_task.quick_task_summary = task['quick-task-summary']
|
270
|
+
my_task.parent_id = task['parent_id']
|
271
|
+
my_task.form_name = task_query['form-name']
|
272
|
+
my_task.creator = task_query['taskData']['created-by']
|
273
|
+
my_task.owner = task['actual-owner']
|
274
|
+
my_task.data = task
|
278
275
|
|
279
|
-
my_task.process
|
280
|
-
my_task.process.data
|
276
|
+
my_task.process = OpenStruct.new
|
277
|
+
my_task.process.data = self.process_instance(task['process-instance-id'])
|
281
278
|
my_task.process.deployment_id = task['deployment-id']
|
282
|
-
my_task.process.id
|
283
|
-
my_task.process.instance_id
|
284
|
-
my_task.process.start_on
|
285
|
-
my_task.process.
|
286
|
-
my_task.process.
|
287
|
-
my_task.process.
|
288
|
-
my_task.process.
|
279
|
+
my_task.process.id = my_task.process.data['process-id']
|
280
|
+
my_task.process.instance_id = my_task.process.data['process-instance-id']
|
281
|
+
my_task.process.start_on = my_task.process.data['start'].nil? ? Time.now : Time.at(my_task.process.data['start']/1000)
|
282
|
+
my_task.process.end_on = my_task.process.data['end'].nil? ? nil : Time.at(my_task.process.data['end']/1000)
|
283
|
+
my_task.process.name = my_task.process.data['process-name']
|
284
|
+
my_task.process.version = my_task.process.data['process-version']
|
285
|
+
my_task.process.creator = my_task.process.data['identity']
|
286
|
+
my_task.process.variables = self.process_instance_variables(my_task.process.instance_id)
|
289
287
|
tasks << my_task
|
290
288
|
end
|
291
289
|
end
|
@@ -298,39 +296,40 @@ module BpmManager
|
|
298
296
|
|
299
297
|
unless input['taskInfoList'].nil? || input['taskInfoList'].empty?
|
300
298
|
input['taskInfoList'].each do |tasks_array|
|
301
|
-
task
|
302
|
-
task_query
|
303
|
-
my_task
|
304
|
-
my_task.id
|
305
|
-
my_task.name
|
306
|
-
my_task.subject
|
307
|
-
my_task.description
|
308
|
-
my_task.status
|
309
|
-
my_task.priority
|
310
|
-
my_task.skippable
|
311
|
-
my_task.created_on
|
312
|
-
my_task.active_on
|
299
|
+
task = tasks_array['taskSummaries'].max_by{|e| e['created-on']} # Selects only the last active task
|
300
|
+
task_query = self.task_query(task['id'])
|
301
|
+
my_task = OpenStruct.new
|
302
|
+
my_task.id = task['id']
|
303
|
+
my_task.name = task['name']
|
304
|
+
my_task.subject = task['subject']
|
305
|
+
my_task.description = task['description']
|
306
|
+
my_task.status = task['status']
|
307
|
+
my_task.priority = task['priority']
|
308
|
+
my_task.skippable = task['skippable']
|
309
|
+
my_task.created_on = Time.at(task['created-on']/1000)
|
310
|
+
my_task.active_on = Time.at(task['activation-time']/1000)
|
313
311
|
my_task.process_instance_id = task['process-instance-id']
|
314
|
-
my_task.process_id
|
315
|
-
my_task.process_session_id
|
316
|
-
my_task.deployment_id
|
317
|
-
my_task.quick_task_summary
|
318
|
-
my_task.parent_id
|
319
|
-
my_task.form_name
|
320
|
-
my_task.creator
|
321
|
-
my_task.owner
|
322
|
-
my_task.data
|
312
|
+
my_task.process_id = task['process-id']
|
313
|
+
my_task.process_session_id = task['process-session-id']
|
314
|
+
my_task.deployment_id = task['deployment-id']
|
315
|
+
my_task.quick_task_summary = task['quick-task-summary']
|
316
|
+
my_task.parent_id = task['parent_id']
|
317
|
+
my_task.form_name = task_query['form-name']
|
318
|
+
my_task.creator = task_query['taskData']['created-by']
|
319
|
+
my_task.owner = task['actual-owner']
|
320
|
+
my_task.data = task
|
323
321
|
|
324
|
-
my_task.process
|
325
|
-
my_task.process.data
|
322
|
+
my_task.process = OpenStruct.new
|
323
|
+
my_task.process.data = self.process_instance(task['process-instance-id'])
|
326
324
|
my_task.process.deployment_id = task['deployment-id']
|
327
|
-
my_task.process.id
|
328
|
-
my_task.process.instance_id
|
329
|
-
my_task.process.start_on
|
330
|
-
my_task.process.
|
331
|
-
my_task.process.
|
332
|
-
my_task.process.
|
333
|
-
my_task.process.
|
325
|
+
my_task.process.id = my_task.process.data['process-id']
|
326
|
+
my_task.process.instance_id = my_task.process.data['process-instance-id']
|
327
|
+
my_task.process.start_on = my_task.process.data['start'].nil? ? Time.now : Time.at(my_task.process.data['start']/1000)
|
328
|
+
my_task.process.end_on = my_task.process.data['end'].nil? ? nil : Time.at(my_task.process.data['end']/1000)
|
329
|
+
my_task.process.name = my_task.process.data['process-name']
|
330
|
+
my_task.process.version = my_task.process.data['process-version']
|
331
|
+
my_task.process.creator = my_task.process.data['identity']
|
332
|
+
my_task.process.variables = self.process_instance_variables(my_task.process.instance_id)
|
334
333
|
tasks << my_task
|
335
334
|
end
|
336
335
|
end
|
data/lib/bpm_manager/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ariel Presa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03
|
11
|
+
date: 2017-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|