Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refactor-minimum-wage-smart-answers'
Merges PR #1856. I've made a number of changes to the minimum-wage shared logic that's used by both am-i-getting-minimum-wage and minimum-wage-calculator-employers. There are quite a few commits but they're all fairly small and I hope the commit message explains the motivation. In broad terms, these are the changes I've made: * Remove unused code: * From unused `precalculate` blocks. * From unused `save_input_as` values. * From unused custom validation where the validation is already provided by the `money_question`. * From parsing that's already handled by questions that use (e.g.) the `parse: Float` option. * Move formatting to templates, e.g. use `OutcomeHelper#format_money`. * Use calculator values in templates and remove no-longer necessary calculate blocks. * Use `validate` blocks instead of custom validation in calculate blocks. Add tests where they didn't exist previously. * Set calculator attributes in `next_node` blocks rather than `calculate` blocks whose return values aren't used. * Consistently use `next_node` blocks rather than the shortcuts available to `multiple_choice` questions. * Instantiate the calculator early on in the flow and then add each response to it as they come in, rather than instantiating the object in one go later on in the flow. I had to add accessors to the calculator to make this possible. Setting attributes directly on the calculator means that I don't have to pollute the state object in order to share variables within the flow. * Move validation logic out of the flow and into the calculator. * Change some tests that were asserting against state variables so that they now assert against values on the calculator. I started out deleting the tests that were asserting against state variables that no longer existed but then realised that it's possible I'd be losing some useful tests. These integration tests that now assert against the calculator should move to the calculator tests if they're deemed useful. __NOTE__. All but the first two questions appear twice, once for determining minimum wage for the current period and once for a previous period. Having now gone through the process I can see a slightly better ordering of commits but trying to reorder the commits in this branch would be a bit painful and probably not worth doing.
- Loading branch information
Showing
239 changed files
with
822 additions
and
615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.