Skip to content

Log GPO letter requested in analytics#6658

Merged
kbighorse merged 26 commits intomainfrom
LG-6793-log-gpo-letter-requested
Aug 4, 2022
Merged

Log GPO letter requested in analytics#6658
kbighorse merged 26 commits intomainfrom
LG-6793-log-gpo-letter-requested

Conversation

@kbighorse
Copy link
Contributor

@kbighorse kbighorse commented Jul 29, 2022

Partially closes https://cm-jira.usa.gov/browse/LG-6793

This pull request adds a DateTime parameter to the analytics event to track that a GPO address letter was requested. Also includes calls from gpo_controller and review_controller and supporting specs.

@kbighorse kbighorse marked this pull request as ready for review August 1, 2022 16:08
@kbighorse kbighorse changed the title Test analytics logs GPO letter requested Log GPO letter requested in analytics Aug 1, 2022
idv_session.complete_session

if idv_session.address_verification_mechanism == 'gpo'
analytics.idv_gpo_address_letter_requested(enqueued_at: Time.zone.now)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just had the thought that we may want to add a resend attribute or something like that to these. That way we can filter by whether a letter is being resent. That could potentially be a different story though.

note: my understanding that these hash values are currently ignored in this spec
'IdV: doc auth verify_wait visited' => { flow_path: 'standard', step: 'verify_wait', step_count: 1 },
'IdV: doc auth optional verify_wait submitted' => { success: true, errors: {}, address_edited: false, proofing_results: { messages: [], exception: nil, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', timed_out: false, context: { dob_year_only: false, should_proof_state_id: true, stages: { resolution: { client: 'ResolutionMock', errors: {}, exception: nil, success: true, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc' }, state_id: { client: 'StateIdMock', errors: {}, success: true, timed_out: false, exception: nil, transaction_id: 'state-id-mock-transaction-id-456', state: 'MT', state_id_jurisdiction: 'ND' } } } }, ssn_is_unique: true, step: 'verify_wait_step_show' },
'IdV: phone of record visited' => {},
'IdV: USPS address letter requested' => { enqueued_at: now },
Copy link
Contributor

Choose a reason for hiding this comment

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

I think freezing time may have actually been the move here. It looks like the controller is still creating the Time object that this is being compared against. As a result they may not be equal if Time advances between the init of this Time object and the controller's Time object.

Around block freezes time so Time.zone.now doesn't drift between initializing and testing
@kbighorse kbighorse merged commit 235fa64 into main Aug 4, 2022
@kbighorse kbighorse deleted the LG-6793-log-gpo-letter-requested branch August 4, 2022 21:48
jmhooper pushed a commit that referenced this pull request Aug 8, 2022
* Test analytics logs GPO letter requested

* Rename new property

* Support path to request letter instead of verify phone

* Create helper method for gpo step

* Test analytics events

* Add expected parameter

* Pass `enqueued_at` to `track_event`

* Modify formatting

* Remove unused event

* Move test to services analytics spec

* Use fake analytics in test

* Rename analytics object

Changelog: Improvements (LG-6793)

categories:
- Improvements

* Add comment on new method

* Rename analytics object

changelog: Internal, Logging, Log the time an address verification letter is enqueued

* Add comment on new method

* Log letter requested when profile is initiated

* Log enqueued at in 2 places

* Camel case data type

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>

* Support extra parameters

* Add trailing comma

* Inject current time as a default value

* Capture current time once for testing later

note: my understanding that these hash values are currently ignored in this spec

* Replace now variable with freeze time

Around block freezes time so Time.zone.now doesn't drift between initializing and testing

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
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.

5 participants