metadata_presenter 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/metadata_presenter/grid.rb +21 -16
- data/lib/metadata_presenter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf82d6e0d0d2d3456a197111c4f9819c7fb67c8d260fc7db6c9c8be24788d30
|
4
|
+
data.tar.gz: '052159fc7c7fe9b069586828b56a9b89abb7737a1714da371616faf484af2949'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 194308706ef13433ad2bebba4bb8c3367e84f0b3d8de4874a67ea0c47065f4a47717c7a29c8564809a0a319d0d381b6122c0203abf0d4fb39d8e618e56ab9cfc
|
7
|
+
data.tar.gz: 815a4558475e02b8b32805f2c8d3c3fc7276b33d1b3497d81221332b3a3b46d1f29248d246267209cfe62692f38f00b0c3b937b37d973568cb59d25cbdb9c34d
|
@@ -124,12 +124,15 @@ module MetadataPresenter
|
|
124
124
|
# Always traverse the route from the start_from uuid. Defaulting to the
|
125
125
|
# start page of the form unless otherwise specified.
|
126
126
|
# Get all the potential routes from any branching points that exist.
|
127
|
+
traversed_uuids = []
|
127
128
|
route_from_start.traverse
|
128
129
|
@routes.append(route_from_start)
|
129
|
-
|
130
|
-
|
130
|
+
traversed_uuids.concat(route_from_start.flow_uuids)
|
131
|
+
routes_to_traverse = route_from_start.routes
|
131
132
|
index = 0
|
132
|
-
|
133
|
+
Rails.logger.info("Total potential routes: #{total_potential_routes}")
|
134
|
+
|
135
|
+
until routes_to_traverse.empty?
|
133
136
|
if index > total_potential_routes
|
134
137
|
ActiveSupport::Notifications.instrument(
|
135
138
|
'exceeded_total_potential_routes',
|
@@ -138,17 +141,22 @@ module MetadataPresenter
|
|
138
141
|
break
|
139
142
|
end
|
140
143
|
|
141
|
-
route =
|
144
|
+
route = routes_to_traverse.shift
|
142
145
|
@routes.append(route)
|
143
146
|
|
144
|
-
#
|
145
|
-
#
|
146
|
-
# traversed
|
147
|
+
# Traverse the route and add any nested routes to the list of routes to
|
148
|
+
# traverse.
|
149
|
+
# If the first flow_uuid in the route has already been traversed, then
|
150
|
+
# this route is looping back, so we don't need to traverse the nested routes.
|
147
151
|
route.traverse
|
148
|
-
|
152
|
+
unless traversed_uuids.include?(route.flow_uuids.first)
|
153
|
+
routes_to_traverse.concat(route.routes)
|
154
|
+
end
|
155
|
+
traversed_uuids.concat(route.flow_uuids)
|
149
156
|
|
150
157
|
index += 1
|
151
158
|
end
|
159
|
+
Rails.logger.info("Total routes traversed: #{index}")
|
152
160
|
end
|
153
161
|
|
154
162
|
def set_column_numbers
|
@@ -441,15 +449,12 @@ module MetadataPresenter
|
|
441
449
|
branch.all_destination_uuids.reject { |uuid| @traversed.include?(uuid) }
|
442
450
|
end
|
443
451
|
|
444
|
-
#
|
445
|
-
#
|
446
|
-
#
|
447
|
-
# number of remaining routes will be the same as the total of all the branch
|
448
|
-
# conditionals.
|
449
|
-
# Add 1 additional route as that represents the route_from_start.
|
452
|
+
# Calculate an upper limit to prevent infinite traversal
|
453
|
+
# Not easy to calculate exactly, aiming for a number that is bigger than
|
454
|
+
# total possible routes but not too much bigger.
|
450
455
|
def total_potential_routes
|
451
|
-
|
452
|
-
|
456
|
+
total_conditionals = service.branches.sum { |branch| branch.conditionals.size + 1 }
|
457
|
+
@total_potential_routes ||= total_conditionals * total_conditionals
|
453
458
|
end
|
454
459
|
end
|
455
460
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metadata_presenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MoJ Forms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|