projector_pws 0.1.17 → 0.1.18
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/projector_pws/version.rb +1 -1
- data/lib/projector_pws.rb +20 -10
- 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: fe9345d3a835dd4be1fef4da59181fa8002a303e
|
4
|
+
data.tar.gz: 47f837cdbc2dd97fcd3007eeefda5c14729cb516
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09d6d7d1ab1dba0048197874c2e7d7776d4e0c5e8b1221c65b64eeb266209fba29db01ab116e3065b6977ea693515112fe83f27d127734a5f0163d0b295444a2
|
7
|
+
data.tar.gz: ccd88edbc8a8583a7ed00721e256ebd01628ab2cc403fdb1918cdd83111da94c9dcbf4f58b0467eb53b36db63123d0fa7e3405327eeb52ec29e4258a480c9443
|
data/lib/projector_pws.rb
CHANGED
@@ -277,11 +277,18 @@ module ProjectorPWS
|
|
277
277
|
} }.select { |x| x[:free_hours] > 0 }
|
278
278
|
end
|
279
279
|
|
280
|
-
#
|
281
|
-
def self.
|
280
|
+
# Compute Resource Active Hours
|
281
|
+
def self.compute_resource_active_hours wsched
|
282
282
|
|
283
|
-
#
|
284
|
-
|
283
|
+
# Extract Working Minutes
|
284
|
+
work = wsched.inject(0) { |a, e| a + e[:working_minutes].to_i }
|
285
|
+
|
286
|
+
# Determine Active Hours
|
287
|
+
work.to_f / MINUTES_PER_HOUR.to_f
|
288
|
+
end
|
289
|
+
|
290
|
+
# Compute Resource Free Hours
|
291
|
+
def self.compute_resource_free_hours scheduled_hours, wsched
|
285
292
|
|
286
293
|
# Get active hours
|
287
294
|
active_hours = get_resource_active_hours c, ticket, resource, start_date, end_date, wsched
|
@@ -294,6 +301,14 @@ module ProjectorPWS
|
|
294
301
|
active_hours - scheduled_hours[:work]
|
295
302
|
end
|
296
303
|
|
304
|
+
# Get Resource Free Hours
|
305
|
+
def self.get_resource_free_hours c, ticket, resource, start_date = current_week_start, end_date = current_week_end, scheduled_hours = nil, wsched = nil
|
306
|
+
|
307
|
+
# Get scheduled hours
|
308
|
+
scheduled_hours ||= get_resource_scheduled_hours c, ticket, resource, start_date, end_date
|
309
|
+
compute_resource_free_hours scheduled_hours, wsched
|
310
|
+
end
|
311
|
+
|
297
312
|
# Get Resource Active Hours
|
298
313
|
def self.get_resource_active_hours c, ticket, resource, start_date = current_week_start, end_date = current_week_end, wsched = nil
|
299
314
|
|
@@ -301,12 +316,7 @@ module ProjectorPWS
|
|
301
316
|
wsched ||= ProjectorPWS.get_resource_working_schedule(c, ticket, resource[:resource_uid], start_date, end_date)[:pws_working_schedule_day] rescue(return(0))
|
302
317
|
wsched = [wsched] unless wsched.is_a? Array
|
303
318
|
wsched.compact!
|
304
|
-
|
305
|
-
# Extract Working Minutes
|
306
|
-
work = wsched.inject(0) { |a, e| a + e[:working_minutes].to_i }
|
307
|
-
|
308
|
-
# Determine Active Hours
|
309
|
-
work.to_f / MINUTES_PER_HOUR.to_f
|
319
|
+
compute_resource_active_hours wsched
|
310
320
|
end
|
311
321
|
|
312
322
|
# Get Resource Scheduled Hours
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: projector_pws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul DUNCAN
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|