bpm_manager 0.9.9 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bpm_manager/red_hat.rb +3 -3
- data/lib/bpm_manager/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c61895e4bada0ee5102c2d9c506421f32b1121a
|
4
|
+
data.tar.gz: bb1585e4cb189df3c8c570195ca0f081ca7ada5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 606831ca1c306ba5e2d07ee14eaac10bc8b493c814002bdd90f1dd440dd40f30fec554150e6701355c92ac12344498342c21009fbaab481cce58a1345a678a15
|
7
|
+
data.tar.gz: ec135ee4c4bed56e3ed9044aea87e116d0c19c0744f88a11aba6cbac19f7c3c1b3f9df2d23169369665012f8d3c6b5107e542e2835e58db557b05a004ec87aa9
|
data/lib/bpm_manager/red_hat.rb
CHANGED
@@ -128,7 +128,7 @@ module BpmManager
|
|
128
128
|
|
129
129
|
unless my_task.nil?
|
130
130
|
sla = OpenStruct.new(:task => OpenStruct.new, :process => OpenStruct.new)
|
131
|
-
|
131
|
+
|
132
132
|
# Calculates the process sla
|
133
133
|
sla.process.status = calculate_sla(my_task.process.start_on, process_sla_hours, warning_offset_percent)
|
134
134
|
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')
|
@@ -148,14 +148,14 @@ 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
|
-
sla_hours > 0 ? Time.at((start.utc + sla_hours).to_f * ((100 - offset) / 100))
|
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
|
152
152
|
end
|
153
153
|
private_class_method :calculate_sla
|
154
154
|
|
155
155
|
def self.calculate_sla_percent(start, sla_hours=0, offset=20)
|
156
156
|
sla_hours = sla_hours.to_f * 3600 # converts to seconds
|
157
157
|
percent = OpenStruct.new
|
158
|
-
total = Time.now.utc - start.utc
|
158
|
+
total = (Time.now.utc - start.utc).to_f
|
159
159
|
|
160
160
|
percent.green = sla_hours > 0 ? ((start.utc + sla_hours).to_f * (100 - offset) / 100) * 100 / total : 100
|
161
161
|
percent.yellow = sla_hours > 0 ? ((start.utc + sla_hours).to_f * 100 / total) - percent.green : 0
|
data/lib/bpm_manager/version.rb
CHANGED