parliament-grom-decorators 0.27.1 → 0.27.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccb208c684538211ff8a3fd376d2f3fae63025b1
|
4
|
+
data.tar.gz: f48dcbeb64ad5db77128bac885bd439adaa3095e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 891c02afa789745d5d9f73bce6eb6eae5be5a82c73f57196beffe1be89eee527078051beb2a59f84e111542005595c3ca050e0ae41f91cf6a4ad1eb54b3d9c40
|
7
|
+
data.tar.gz: 523446ec6616cde844ef0d9e3eb659d150b791ca9a66e470828c5d91d8fc9a694d8c294afef113b5b84160b90a78e3c6e629e97d30d18c1260887388ce04ef29
|
@@ -18,6 +18,13 @@ module Parliament
|
|
18
18
|
procedure_steps.sort_by(&:distance_from_origin)
|
19
19
|
end
|
20
20
|
|
21
|
+
# Finds, for each of the procedure steps belonging to a business item, the shortest distance from origin
|
22
|
+
#
|
23
|
+
# @return [Integer, nil] shortest distance of procedure steps from origin or nil.
|
24
|
+
def shortest_distance_of_procedure_steps
|
25
|
+
sorted_procedure_steps_by_distance.first&.distance_from_origin
|
26
|
+
end
|
27
|
+
|
21
28
|
# Alias businessItemDate with fallback.
|
22
29
|
#
|
23
30
|
# @return [Date, nil] a laying date or nil.
|
@@ -31,14 +38,6 @@ module Parliament
|
|
31
38
|
def weblink
|
32
39
|
respond_to?(:businessItemHasBusinessItemWebLink) ? businessItemHasBusinessItemWebLink : ''
|
33
40
|
end
|
34
|
-
|
35
|
-
# Alias layingHasLayingBody with fallback.
|
36
|
-
# NB. One and only one group has to lay, so it will always be the first laying body
|
37
|
-
#
|
38
|
-
# @return [Grom::Node, nil] a Grom::Node representing the group that did the laying.
|
39
|
-
def laying_body
|
40
|
-
respond_to?(:layingHasLayingBody) ? layingHasLayingBody.first : nil
|
41
|
-
end
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
@@ -3,6 +3,7 @@ module Parliament
|
|
3
3
|
module Decorator
|
4
4
|
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/WorkPackage
|
5
5
|
module WorkPackage
|
6
|
+
include Helpers::DateHelper
|
6
7
|
# Alias workPackageHasProcedure with fallback.
|
7
8
|
# NB: Currently, work packages only have one procedure
|
8
9
|
#
|
@@ -19,6 +20,11 @@ module Parliament
|
|
19
20
|
respond_to?(:workPackageHasWorkPackageableThing) ? workPackageHasWorkPackageableThing.first : nil
|
20
21
|
end
|
21
22
|
|
23
|
+
# @return [String, nil] the name of the Grom::Node or an empty string.
|
24
|
+
def work_packageable_thing_name
|
25
|
+
work_packageable_thing&.name
|
26
|
+
end
|
27
|
+
|
22
28
|
# Alias workPackageHasBusinessItem with fallback.
|
23
29
|
#
|
24
30
|
# @return [Array, Array] an array of BusinessItem Grom::Nodes or an empty array.
|
@@ -26,15 +32,11 @@ module Parliament
|
|
26
32
|
respond_to?(:workPackageHasBusinessItem) ? workPackageHasBusinessItem : []
|
27
33
|
end
|
28
34
|
|
29
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
business_items.sort_by(&:date).last
|
33
|
-
end
|
34
|
-
|
35
|
-
# @return [Date, nil] an array of BusinessItem Grom::Nodes or an empty array.
|
35
|
+
# Alias oldestBusinessItemDate with fallback.
|
36
|
+
#
|
37
|
+
# @return [Date, nil] a date or nil.
|
36
38
|
def oldest_business_item_date
|
37
|
-
|
39
|
+
respond_to?(:oldestBusinessItemDate) ? DateTime.parse(oldestBusinessItemDate) : nil
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -3,6 +3,7 @@ module Parliament
|
|
3
3
|
module Decorator
|
4
4
|
# Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/WorkPackageableThing
|
5
5
|
module WorkPackageableThing
|
6
|
+
include Helpers::DateHelper
|
6
7
|
# Alias workPackageableThingName with fallback.
|
7
8
|
#
|
8
9
|
# @return [String, String] the name of the Grom::Node or an empty string.
|
@@ -25,22 +26,9 @@ module Parliament
|
|
25
26
|
respond_to?(:workPackageableThingHasWorkPackageableThingWebLink) ? workPackageableThingHasWorkPackageableThingWebLink : ''
|
26
27
|
end
|
27
28
|
|
28
|
-
# Uses work_package method in this set of decorators, which could return nil.
|
29
|
-
# Uses business_items method in WorkPackage decorators, which could return an empty array.
|
30
|
-
#
|
31
|
-
# @return [Boolean] whether a work packageable thing has both a work package and some business items.
|
32
|
-
def work_package_and_business_items?
|
33
|
-
work_package ? work_package.business_items.any? : false
|
34
|
-
end
|
35
|
-
|
36
|
-
# @return [Grom::Node, nil] a BusinessItem Grom::Node or nil.
|
37
|
-
def oldest_business_item
|
38
|
-
work_package_and_business_items? ? work_package.business_items.sort_by(&:date).last : nil
|
39
|
-
end
|
40
|
-
|
41
29
|
# @return [Date, nil] an array of BusinessItem Grom::Nodes or an empty array.
|
42
30
|
def oldest_business_item_date
|
43
|
-
|
31
|
+
work_package&.oldest_business_item_date
|
44
32
|
end
|
45
33
|
|
46
34
|
# Alias workPackageableThingComingIntoForceDate with fallback.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parliament-grom-decorators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.27.
|
4
|
+
version: 0.27.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rebecca Appleyard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|