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 marriage-abroad outcome_os_consular_cni precalculate blocks #2388

Conversation

chrisroos
Copy link
Contributor

This has been superseded by PR #2394.

I'm continuing to refactor marriage-abroad. This branch removes the precalculate blocks from outcome_os_consular_cni by adding logic to the MarriageAbroadCalculator.

I can only imagine this was an oversight when the array/string was first
added in ff781c5.
Move this array of countries from the flow to the
`MarriageAbroadDataQuery`.
Move this array of countries from the flow to the
`MarriageAbroadDataQuery`.
Move this array of countries from the flow to the
`MarriageAbroadDataQuery`.
Move this array of countries from the flow to the
`MarriageAbroadDataQuery`.
Move this array of countries from the flow to the
`MarriageAbroadDataQuery`.
Move this array of countries from the flow to the
`MarriageAbroadDataQuery`.
The outcome_os_consular_cni template doesn't use the string that was
being returned: it's only interested in whether this value is truthy or
falsey.
The outcome_os_consular_cni template doesn't use the string that was
being returned: it's only interested in whether this value is truthy or
falsey.
It's only used in the `:birth_cert_inclusion` precalculate block.
Use it instead of the `:three_day_residency_requirement_applies`
precalculate block.

Part of refactoring marriage-abroad. See doc/refactoring.md for more.
I _think_ this makes it clearer that the countries in this array
are related to the countries listed in the conditionals just before this
block of code in outcome_os_consular_cni. It also makes it clearer that
'italy' shouldn't be in this list as that now has its own outcome.
Use it instead of the `:cni_posted_after_14_days_countries` precalculate
block.

Part of refactoring marriage-abroad. See doc/refactoring.md for more.
This feels too specific to add to the `MarriageAbroadCalculator`.
This is confusing as the NO_BIRTH_CERT_REQUIREMENT array contains a list
of countries that don't require a birth certificate as a supporting
document. We then check that the ceremony country isn't in that list in
order to determine whether a birth certificate is required. I'm sure this
can be improved but I think it's OK for now.
This should've been removed as part of PR #2349 but I overlooked it.
I _think_ Macedonia is in this list because it's handled elsewhere in
the outcome_os_consular_cni template, rather than because it's a
`:notary_public_inclusion` country.

There are already other special cases dealing with Macedonia in the
template and I'm hoping this'll make it easy to remove more duplication
further down the line.
In preparation for splitting this onto multiple lines. This'll make it
easier to see other changes I plan to make to these conditions.
To make it easier to see the changes I want to make to it.
This will make it easier to remove duplication between the use of
`cni_notary_public_countries` and `notary_public_inclusion`.
Remove duplication by using `notary_public_inclusion` instead of
`cni_notary_public_countries.include?(calculator.ceremony_country`.
It's only used in the `:notary_public_inclusion` precalculate block.
Use it instead of the `:notary_public_inclusion` precalculate block.

Part of refactoring marriage-abroad. See doc/refactoring.md for more.
Use it instead of the
`:no_document_download_link_if_os_resident_of_uk_countries` precalculate
block.

Part of refactoring marriage-abroad. See doc/refactoring.md for more.

I struggled with the naming of this method as the logic seems confusing.
The `NO_DOCUMENT_DOWNLOAD_LINK_IF_OS_RESIDENT_OF_UK_COUNTRIES` array
contains a list of ceremony countries that _don't_ allow you to download
the notice of and affidavit for marriage forms. We check that the
ceremony country _isn't_ in this list in order to decide whether to
display the download
TODO: Double check the regression tests.

Updated using:

    $ rails r script/generate-checksums-for-smart-answer.rb \
    marriage-abroad
@floehopper
Copy link
Contributor

Other than my minor comments, this looks good to me.

@chrisroos
Copy link
Contributor Author

Thanks for reviewing, @floehopper.

I've rebased on master and addressed feedback so I'm going to close this and open a new PR in its place.

@chrisroos chrisroos closed this Mar 22, 2016
@chrisroos chrisroos deleted the remove-marriage-abroad-outcome-os-consular-cni-precalculate-blocks branch March 22, 2016 02:23
@chrisroos
Copy link
Contributor Author

This has been superseded by PR #2394.

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