Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Define permitted next nodes for all flows #2002

Closed
wants to merge 52 commits into from

Conversation

chrisroos
Copy link
Contributor

Trello card - https://trello.com/c/jtjRNOW9/97-update-all-flows-to-use-permitted-next-nodes

I've updated Question::Base#next_node_for to raise an exception if the next_node isn't found in the list of permitted_next_nodes.

I've updated the first three flows to use permitted_next_nodes where required to get an idea of how they're going to look.

NOTE. Using next_node :symbol or next_node_if automatically add the nodes to permitted_next_nodes so I've only updated the flows/questions that use next_node with a block.

The advantage of using permitted_next_nodes is that it allows us to visualise the flows.

Visualising additional-commodity-code

Before

permitted-next-nodes-before

After

permitted-next-nodes-after

TODO: Expand this commit message. Consider moving this commit after
all the commits to add the relevant permitted_next_nodes statements
Updated using:

    $ rails r script/generate-checksums-for-smart-answer.rb \
    additional-commodity-code
Updated using:

    $ rails r script/generate-checksums-for-smart-answer.rb \
    am-i-getting-minimum-wage

    $ rails r script/generate-checksums-for-smart-answer.rb \
    minimum-wage-calculator-employers
Updated using:

    $ rails r script/generate-checksums-for-smart-answer.rb \
    benefit-cap-calculator
@floehopper floehopper self-assigned this Oct 13, 2015
@floehopper
Copy link
Contributor

Other than my comments above, this looks good to me. I agree that initially we could just update the flows which use next_node with a block.

Updated using:

    $ rails r script/generate-checksums-for-smart-answer.rb \
    am-i-getting-minimum-wage

    $ rails r script/generate-checksums-for-smart-answer.rb \
    minimum-wage-calculator-employers
Updated using:

    rails r script/generate-checksums-for-smart-answer.rb \
    calculate-married-couples-allowance
@chrisroos
Copy link
Contributor Author

@floehopper: Can you take another look at this pull request, please? If you think the result is OK then I plan to rewrite history and open another pull result. Here's the plan:

  • Add support for specifying permitted next nodes through the permitted option to next_node
  • Define permitted next nodes for each flow, updating the checksum data each time
  • Fail fast if next_node is given a block but the permitted option isn't set
  • Fail fast in next_node_for if the next node doesn't exist in the array of @permitted_next_nodes

I think this ordering of commits should mean that all the tests pass each time.

@floehopper
Copy link
Contributor

Minor: I might be inclined to combine the checksum update commits with their respective commit which changes the flow. I think separating changes to the test artefacts into separate commits can be useful, because there are often a lot of files changing, but I'm not sure it's justified in the case of just a checksum change.

@floehopper
Copy link
Contributor

Very minor: I might be inclined to incorporate the Rubocop changes in the commits which triggered them.

@floehopper
Copy link
Contributor

Other than my comments, this LGTM 👍

@chrisroos
Copy link
Contributor Author

I might be inclined to combine the checksum update commits with their respective commit which changes the flow.

Yup - I'm planning to do that in the new branch.

@chrisroos
Copy link
Contributor Author

I might be inclined to incorporate the Rubocop changes in the commits which triggered them.

Good idea.

@chrisroos
Copy link
Contributor Author

Closing in favour of PR #2010.

@chrisroos chrisroos closed this Oct 14, 2015
@chrisroos chrisroos deleted the define-permitted-next-nodes-for-all-flows branch October 14, 2015 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants