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

Remove unused code from pay-leave-for-parents #2006

Merged
merged 3 commits into from
Oct 14, 2015

Conversation

chrisroos
Copy link
Contributor

I came across this unused code while adding regression tests for pay-leave-for-parents.

I think it makes sense to remove it before converting pay-leave-for-parents to a Ruby Smart Answer.

Expected user-visible changes

  • None.

@floehopper floehopper self-assigned this Oct 14, 2015
@floehopper
Copy link
Contributor

Looks good to me. Well spotted! 😄

The both-shared-pay snippet is rendered by the following outcomes:

* outcome_mat-leave_mat-pay_pat-leave_pat-pay_both-shared-leave_both-shared-pay
* outcome_mat-leave_mat-pay_pat-pay_mat-shared-leave_both-shared-pay
* outcome_mat-pay_pat-leave_pat-pay_pat-shared-leave_both-shared-pay
* outcome_mat-pay_pat-pay_both-shared-pay

These outcomes can only be reached if the due date is on or after 5 April 2015.
This means that the check for `$IF range_in_2013_2014_fin_year?(due_date)` will
never be true.
The pat-shared-pay snippet is rendered by the following outcomes:

* outcome_mat-allowance_mat-leave_pat-leave_pat-pay_both-shared-leave_pat-shared-pay
* outcome_mat-allowance_mat-leave_pat-leave_pat-pay_pat-shared-leave_pat-shared-pay
* outcome_mat-allowance_mat-leave_pat-pay_mat-shared-leave_pat-shared-pay
* outcome_mat-allowance_mat-leave_pat-pay_pat-shared-pay
* outcome_mat-allowance_pat-leave_pat-pay_pat-shared-leave_pat-shared-pay
* outcome_mat-allowance_pat-pay_pat-shared-pay

These outcomes can only be reached if the due date is on or after 5 April 2015.
This means that the check for `$IF range_in_2013_2014_fin_year?(due_date)` will
never be true.
The mat-shared-pay snippet is rendered by the following outcomes:

* outcome_mat-leave_mat-pay_mat-shared-leave_mat-shared-pay
* outcome_mat-leave_mat-pay_pat-leave_both-shared-leave_mat-shared-pay
* outcome_mat-pay_mat-shared-pay
* outcome_mat-pay_pat-leave_pat-shared-leave_mat-shared-pay

These outcomes are all reached from employment_details_of_partner_2b, which can
only be reached from employment_details_of_partner_2a, which in turn can only be
reached if the due date is on or after 5 Apr 2015. This means that the check for
`$IF range_in_2013_2014_fin_year?(due_date)` will never be true.
@chrisroos chrisroos force-pushed the remove-unused-code-from-pay-leave-for-parents branch from 752dfac to 811576a Compare October 14, 2015 12:50
@chrisroos
Copy link
Contributor Author

Rebased and force pushed in preparation for merging.

chrisroos added a commit that referenced this pull request Oct 14, 2015
…ave-for-parents

Remove unused code from pay-leave-for-parents
@chrisroos chrisroos merged commit 7c4a0a6 into master Oct 14, 2015
@chrisroos chrisroos deleted the remove-unused-code-from-pay-leave-for-parents branch October 14, 2015 12:56
chrisroos added a commit that referenced this pull request Oct 14, 2015
I've arbitrarily chosen salary amounts of £10,000/year.

I came up with the due dates up by running the regression tests multiple times
until I was confident that I was covering all code branches in the
outcomes/snippets. I did this by adding marker text in the various conditionals,
running the regression tests and then comparing the marker text in the test
artefacts to the marker text in the outcomes/snippets. This set of due dates
allows me to reach each path. This approach helped me find some unused code
paths which I've removed in PR #2006.
chrisroos added a commit that referenced this pull request Oct 15, 2015
I've arbitrarily chosen salary amounts of £10,000/year.

I came up with the due dates up by running the regression tests multiple times
until I was confident that I was covering all code branches in the
outcomes/snippets. I did this by adding marker text in the various conditionals,
running the regression tests and then comparing the marker text in the test
artefacts to the marker text in the outcomes/snippets. This set of due dates
allows me to reach each path. This approach helped me find some unused code
paths which I've removed in PR #2006.
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