Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Lazy automatic detection of possible next nodes #2343
Previously the possible node keys returned by a
In order to make use of this mechanism, you should set the
Note that if you fail to wrap the node key, you will see an exception when that node is chosen much as you would've done if a node not in the list of permitted next nodes was chosen. Note also that at the moment the
multiple_choice :question? do option :option_one option :option_two permitted_next_nodes = [ :solution_one, :solution_two ] next_node(permitted: permitted_next_nodes) do |response| case response when :option_one :solution_one when :option_two :solution_two end end end
multiple_choice :question? do option :option_one option :option_two next_node(permitted: :auto) do |response| case response when :option_one outcome :solution_one when :option_two outcome :solution_two end end end
However, in contrast to #2311, the automatic detection of possible next nodes is now only triggered when a flow is being visualised via the
Unfortunately the logic in
I did contemplate adding a new engine/integration test for the new behaviour. However, in the end I decided that updating all the fixtures for the existing engine/integration tests gave enough coverage and was more in keeping with the current state of affairs. Also I was pleased to see that the
I have not updated any published flows to use the new style
For further details, please see the individual commit notes.
I think we might have problems using this approach if we also want to use
This all looks good to me. It took me quite a while to understand what was going on but I think I've got it now! As you've already mentioned, the code should be easier to understand once we've removed support for supplying the permitted next nodes via the
Great work, @floehopper!
@chrisroos: Can you explain why we might have problems using this approach in flows which use
if calculator.study_visit? || calculator.work_visit? next question(:staying_for_how_long?) end
And ran its regression test and they all passed. Am I missing something?
@floehopper: Sorry - my mistake! When I was trying this branch locally I ran into problems visualising the check-uk-visa flow after updating it to use the