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

Find End Product without End Product Establishment for RAMP #10363

Merged
merged 7 commits into from
Apr 9, 2019

Conversation

leikkisa
Copy link
Contributor

@leikkisa leikkisa commented Apr 8, 2019

connects #9964

If the EndProductEstablishment for a RAMP intake isn't saved, find the matching end product when needed

@ghost ghost assigned leikkisa Apr 8, 2019
@ghost ghost added the In-Progress label Apr 8, 2019
@codeclimate
Copy link

codeclimate bot commented Apr 8, 2019

Code Climate has analyzed commit e10fb23 and detected 0 issues on this pull request.

View more on Code Climate.

@@ -79,7 +79,7 @@ def validate_detail_on_start
@error_data = veteran_invalid_fields
elsif ramp_elections.empty?
self.error_code = :no_complete_ramp_election
elsif ramp_elections.all?(&:end_product_active?)
elsif ramp_elections.any?(&:end_product_active?)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this was a mistake in the original logic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit 072065d suggests otherwise. It was any? before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think this is a mistake.

Maybe what we need to check here is if there is at least one cleared RampElection. What we're seeing is that there can be active ones and canceled ones, and it seems to me that if there is an active RampElection (of which there can only be one at a time for each of the two modifiers) and a canceled RampElection, and no cleared RAMP elections, then it's not ready for a RampRefiling.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, this change isn't necessary for this PR, I just thought it was wrong logic, so we could also wait on this change for Shane.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's not necessary for this PR, let's revert that line for now and open a ticket to remind ourselves to ask Shane.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New ticket: #10377

Copy link
Contributor

@pkarman pkarman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks fine.

The approach makes me a little nervous though, because we are changing some business rules to try and match just-in-time within the existing models, rather than applying a one-time backfill via an external rake task or script.

What would you think about refactoring the matching logic to not be in the models themselves but as a ramp:backfill_epe rake task that we could run in off hours to create the missing EPEs? We could do a few at a time to verify it works.

app/models/end_product_establishment.rb Outdated Show resolved Hide resolved
@@ -79,7 +79,7 @@ def validate_detail_on_start
@error_data = veteran_invalid_fields
elsif ramp_elections.empty?
self.error_code = :no_complete_ramp_election
elsif ramp_elections.all?(&:end_product_active?)
elsif ramp_elections.any?(&:end_product_active?)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit 072065d suggests otherwise. It was any? before.

@leikkisa
Copy link
Contributor Author

leikkisa commented Apr 9, 2019

I would be a big fan of doing a backfill for the unconnected RampElections, that would be less hacky. Shane is nervous about backfilling data at all so this is more of a bandaid. However, I do feel that the explanation here: #9946
is satisfying enough to me to justify backfilling the missing unconnected EPEs.

Copy link
Contributor

@pkarman pkarman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@leikkisa leikkisa added the Ready-to-Merge This PR is ready to be merged and will be picked up by va-bot to automatically merge to master label Apr 9, 2019
@va-bot va-bot merged commit 2eef348 into master Apr 9, 2019
@va-bot va-bot deleted the 9946-ramp-find-end-product branch April 9, 2019 23:00
@ghost ghost removed the In-Progress label Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready-to-Merge This PR is ready to be merged and will be picked up by va-bot to automatically merge to master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants