Skip to content

LG-10126: For notification phone configurations; handle expired enrollments outside of jobs#8875

Merged
tomas-nava merged 4 commits intomainfrom
tomas/lg-10126-handle-expired-enrollments
Jul 27, 2023
Merged

LG-10126: For notification phone configurations; handle expired enrollments outside of jobs#8875
tomas-nava merged 4 commits intomainfrom
tomas/lg-10126-handle-expired-enrollments

Conversation

@tomas-nava
Copy link
Contributor

🎫 Ticket

Related to LG-10126

🛠 Summary of changes

Has the InPersonEnrollment model delete NotificationPhoneConfiguration associated with enrollments when they expire, rather than relying on the GetUspsProofingResultsJob or the SendProofingNotificationJob to delete them. (see d67c903)

Also starts using constants to refer to the in person enrollment states, for clarity when reading and writing code. (see c0e725d)

Tomas Apodaca added 2 commits July 26, 2023 15:17
changelog: Internal, In-person proofing, Delete notification phone configuration when enrollment is marked expired

has_one :notification_phone_configuration, dependent: :destroy, inverse_of: :in_person_enrollment

STATUS_ESTABLISHING = 'establishing'
Copy link
Contributor

Choose a reason for hiding this comment

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

good change - i like that this now looks more like an enum

)

enrollment.profile.activate if raw_enrollment_status == 'passed'
if raw_enrollment_status == InPersonEnrollment::STATUS_PASSED
Copy link
Contributor

Choose a reason for hiding this comment

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

subtle change but i do think it's more immediately readable

Copy link
Contributor

@svalexander svalexander left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@sheldon-b sheldon-b left a comment

Choose a reason for hiding this comment

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

Cool! Nice refactor. One question for my own benefit

def enrollment_will_be_cancelled?
status_change_to_be_saved&.last == 'cancelled'
def enrollment_will_be_cancelled_or_expired?
[STATUS_CANCELLED, STATUS_EXPIRED].include? status_change_to_be_saved&.last
Copy link
Contributor

Choose a reason for hiding this comment

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

What is status_change_to_be_saved? Is that some ActiveRecord thing showing staged changes yet to be committed to the db? I didn't see anything on a quick google search

Copy link
Contributor Author

@tomas-nava tomas-nava Jul 27, 2023

Choose a reason for hiding this comment

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

yeah, it's rails magic. You can use <name>_change_to_be_saved to get the value for any variable that's being updated.

@tomas-nava tomas-nava merged commit 47ebffe into main Jul 27, 2023
@tomas-nava tomas-nava deleted the tomas/lg-10126-handle-expired-enrollments branch July 27, 2023 20:05
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.

3 participants