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

Assign house_number and address_lines consistently #281

Merged
merged 9 commits into from
Oct 10, 2018

Conversation

irisfaraway
Copy link
Member

https://eaflood.atlassian.net/browse/WC-500

Addresses created in the renewals journey can display as having a duplicate house number when they are used by waste-carriers-frontend, for example:

123
123 Waste Street
Wastetown
AB1 2CD

This is because the renewals engine assigns the values of address_lines in a different way. For consistency's sake, we should change this to match how waste-carriers-frontend does it.

https://eaflood.atlassian.net/browse/WC-500

Addresses created in the renewals journey can display as having a duplicate house number when they are used by waste-carriers-frontend, for example:

123
123 Waste Street
Wastetown
AB1 2CD

This is because the renewals engine assigns the values of address_lines in a different way. For consistency's sake, we should change this to match how waste-carriers-frontend does it.
The first `line` should be assigned to `house_number` and all subsequent lines should be assigned to `address_lines`.
Rather than trying to work out which lines we want ourselves, we just use the `lines` values from the data sent by os-places-address-lookup. We also get `house_number` from the lines instead of the `buildingNumber` value. This should give us a result which is consistent with the frontend.
This is more accurate about what it's now doing.
This is no longer included in `address_line_1` so we need to add it separately.
We display addresses multiple times, so it's more efficient to have a shared helper method to deal with this.
…page

Now that we have a shared method, we can replace the logic specific to the check your answers form object and view.
We can now remove the duplicated logic from the mailer and update the template to use the new method.
@irisfaraway
Copy link
Member Author

There'll be some small changes to waste-carriers-back-office once this is merged in as we can reuse the new displayable_address method there too.

irisfaraway added a commit to DEFRA/waste-carriers-back-office that referenced this pull request Oct 10, 2018
The `address_lines` method is another example of duplication which can now be replaced by the method added in DEFRA/waste-carriers-engine#281
irisfaraway added a commit to DEFRA/waste-carriers-back-office that referenced this pull request Oct 10, 2018
The `address_lines` method is another example of duplication which can now be replaced by the method added in DEFRA/waste-carriers-engine#281
@irisfaraway irisfaraway merged commit 3565d4e into master Oct 10, 2018
@irisfaraway irisfaraway deleted the fix/assign-address-lines branch October 10, 2018 16:19
irisfaraway added a commit to DEFRA/waste-carriers-back-office that referenced this pull request Oct 11, 2018
The `address_lines` method is another example of duplication which can now be replaced by the method added in DEFRA/waste-carriers-engine#281
@irisfaraway irisfaraway added the bug Something isn't working label Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants