LG-7345: Generate a unique ID when creating enrollments#6883
Merged
Conversation
sheldon-b
commented
Aug 31, 2022
Base automatically changed from
sbachstein/lg-6964-expand-usps-polling-analytics
to
main
August 31, 2022 18:37
a9d13e9 to
072091d
Compare
added 3 commits
September 1, 2022 11:02
aduth
reviewed
Sep 1, 2022
aduth
reviewed
Sep 1, 2022
aduth
reviewed
Sep 1, 2022
eileen-nava
reviewed
Sep 1, 2022
Contributor
eileen-nava
left a comment
There was a problem hiding this comment.
Since I'm still learning the codebase, I don't feel comfortable approving the PR for merge. However, I found it very educational to read through this PR! The code is very readable.
|
|
||
| it 'sets enrollment status to pending and sets enrollment established at date' do | ||
| context 'when the enrollment does not have a unique ID' do | ||
| it 'uses the deprecated InPersonEnrollment#usps_unique_id value to create the enrollment' do |
Contributor
There was a problem hiding this comment.
Ohhhhh, okay, this spec answers my previous question in a comment on enrollment_helper.rb. 👍🏻
Merged
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.
🔮 Context
The USPS API requires us to specify a unique ID when we create an enrollment. Initially we did not store that value in the database and instead just grabbed 18 digits of the user's UUID -- this was a temporary workaround until we fleshed out the unique ID generation better
Since that initial workaround we've added a
unique_iddatabase column on the InPersonEnrollment model. The polling job sets that value and uses it once it's set, but it isn't used when we actually create the enrollment in the USPS APICurrent sequence of actions
establishing. No unique ID is generated and the field is left emptyInPersonEnrollment#usps_unique_id, which uses 18 digits of the user's UUIDpendingpendingenrollment. If the enrollment does not have a unique ID value saved then we set it toInPersonEnrollment#usps_unique_id(which would've been used to create the enrollment in the USPS API)enrollment.unique_id, which was just set in the previous stepWhat this PR implements
changes in bold
context in italics
establishing. When the enrollment is created we generate and save a unique ID usingInPersonEnrollment.generate_unique_idenrollment.unique_idif it existsInPersonEnrollment#usps_unique_id, which uses 18 digits of the user's UUIDpendingpendingenrollment. If the enrollment does not have a unique ID value saved then we set it toInPersonEnrollment#usps_unique_id(which would've been used to create the enrollment in the USPS API)enrollment.unique_id. For enrollments created before this PR these values would have been set in the previous step. For enrollments created after this PR this value would have been set when the enrollment was first created at step 1Future work
Eventually we'll set the
unique_idfield to be a required field. Then we can simplify step 2 above to always useenrollment.unique_idand we can remove step 4 above. This is captured in LG-7024🚧 Changes
InPersonEnrollmentmodel to generate a unique ID automatically if one isn't provided