projector_pws 0.1.12 → 0.1.13

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: b4824e8aba39fbc0d0ea303f332e2d6f827f1e27
4
- data.tar.gz: d6cafd9787296f98eca31a0a479f9a7448da7796
3
+ metadata.gz: 6a71a8759a76f14373d291c3fd0c9e74ef3c46f4
4
+ data.tar.gz: a261e7110d7b3cb975cddfca78ae1a694a91710b
5
5
  SHA512:
6
- metadata.gz: 86ddb97ea78fbf71adb34743386c691229dbf6b17fcd863283525629f7f175fd9068ab1291d2b473bda6d51861254bd4da2669e927fd7b585d345630a4ee563d
7
- data.tar.gz: f835aceb04fef3b12abf6d596c0fa22351d89e29c3c5aa94fa8a590447bc2ff04741859d5c986f7d1489eaacf0fe721a3a0d631446be729d92a4e5abcdcd5499
6
+ metadata.gz: 24ea19fb4d9189d41a97ef9cb99a327f80f75fe3c4f921b5863808ded0dce5130931703a03e30b23365da1a791e3207ae2633fbed453e028d42c527fc88d32ae
7
+ data.tar.gz: e15a9ea7a6027a982d506f78342f46033c76b92e487b7a1ba7d23f44d63059fe69b03fadf90b07128564943c61f354b670c3319f02476c67664bde6cb3c04306
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Paul Duncan
3
+ Copyright (c) 2018 Paul Duncan
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -5,5 +5,5 @@
5
5
  module ProjectorPWS
6
6
 
7
7
  # Version
8
- VERSION = '0.1.12'
8
+ VERSION = '0.1.13'
9
9
  end
data/lib/projector_pws.rb CHANGED
@@ -269,8 +269,9 @@ module ProjectorPWS
269
269
  # Get active hours
270
270
  active_hours = get_resource_active_hours c, ticket, resource, start_date, end_date
271
271
 
272
- # Compute time off into active hours
272
+ # Compute time off and holidays into active hours
273
273
  active_hours = active_hours - scheduled_hours[:toff]
274
+ active_hours = active_hours - scheduled_hours[:hday]
274
275
 
275
276
  # Compute free time (active unscheduled time)
276
277
  active_hours - scheduled_hours[:work]
@@ -307,6 +308,11 @@ module ProjectorPWS
307
308
  time_off = [time_off] unless time_off.is_a? Array
308
309
  time_off.compact!
309
310
 
311
+ # Extract Holidays
312
+ holidays = sched[:holidays][:pws_schedule_holiday] rescue []
313
+ holidays = [holidays] unless holidays.is_a? Array
314
+ holidays.compact!
315
+
310
316
  # Run through time off { collect total minutes }
311
317
  time_off_minutes = time_off.inject(0) do |a, e|
312
318
 
@@ -319,6 +325,9 @@ module ProjectorPWS
319
325
  a + dates.inject(0) { |da, de| da + time_off_minutes(de[:time_off_minutes].to_i) }
320
326
  end
321
327
 
328
+ # Run through Holidays { collect total minutes }
329
+ holiday_minutes = holidays.reject { |e| e[:date] < start_date || e[:date] > end_date || e[:date].saturday? || e[:date].sunday? }.inject(0) { |a, e| a + time_off_minutes(e[:time_off_minutes].to_i) }
330
+
322
331
  # Run through schedule { collect total minutes }
323
332
  scheduled_minutes = sched_work.inject(0) do |a, e|
324
333
 
@@ -333,7 +342,8 @@ module ProjectorPWS
333
342
 
334
343
  {
335
344
  work: scheduled_minutes.to_f / MINUTES_PER_HOUR.to_f,
336
- toff: time_off_minutes.to_f / MINUTES_PER_HOUR.to_f
345
+ toff: time_off_minutes.to_f / MINUTES_PER_HOUR.to_f,
346
+ hday: holiday_minutes.to_f / MINUTES_PER_HOUR.to_f
337
347
  }
338
348
  end
339
349
 
@@ -6,8 +6,8 @@ require 'projector_pws/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'projector_pws'
8
8
  spec.version = ProjectorPWS::VERSION
9
- spec.authors = ['Eresse']
10
- spec.email = ['eresse@eresse.net']
9
+ spec.authors = ['Paul DUNCAN']
10
+ spec.email = ['pduncan@openwt.com']
11
11
 
12
12
  spec.summary = 'Projector PWS Client Library'
13
13
  spec.description = 'Provides access to Projector PSA\'s Web Services (PWS)'
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.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
- - Eresse
7
+ - Paul DUNCAN
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-21 00:00:00.000000000 Z
11
+ date: 2018-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,7 +82,7 @@ dependencies:
82
82
  version: '0'
83
83
  description: Provides access to Projector PSA's Web Services (PWS)
84
84
  email:
85
- - eresse@eresse.net
85
+ - pduncan@openwt.com
86
86
  executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []