Draft
Conversation
To make it clear that this creates a PatientChangeset.
I found it confusing that there was a local variable named `changesets` and an ActiveRecord association named `changesets` (defined in both `ClassImport` and `CohortImport`), and that this method was operating on both. By removing this local variable we can be sure that this method is always operating on the `changesets` association.
This was here to distinguish between the `changesets` local variable and the association. Now that we're always operating on the association it's no longer necessary.
I think the intention here is to _not_ queue up `changesets.without_postcode` because they've already been queued up earlier in the method. If `changesets.with_postcode.any?` is truthy then this method would've returned earlier, on line 72. The fact that we've reached this line means that `changesets.with_postcode` will be empty so let's make that explicit by returning an empty array.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an exploration into tidying up the
PatientImport#process!method. It's not ready for review.