Skip to content

Commit a647128

Browse files
authored
Merge pull request #10 from merefield/copilot/sub-pr-9
Fix N+1 query in workflow visualization controller
2 parents d7ad34c + 7d1cbad commit a647128

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/controllers/discourse_workflow/workflow_visualisation_controller.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def network
5454
# Links: from each step via its options
5555
links = []
5656

57+
# Build a hash of step_id => step to avoid N+1 queries
58+
steps_by_id = steps.index_by(&:id)
59+
5760
steps.each do |step|
5861
step.workflow_step_options.each do |option|
5962
target_step = steps_by_id[option.target_step_id]

0 commit comments

Comments
 (0)