DoSomething / chompy

:card_index: The DoSomething.org third-party importer.
MIT License
1 stars 0 forks source link

Avoid double importing Rock the Vote records #148

Closed aaronschachter closed 4 years ago

aaronschachter commented 4 years ago

What's this PR do?

This pull request modifies the RTV import to only process a record if it hasn't been logged in the rock_the_vote_logs table.

How should this be reviewed?

The code changes are pretty small, this PR mostly adds test coverage to ensure these changes work as expected. What's changed:

Any background context you want to provide?

It hasn't been a big deal to re-process a record thus far, because we only update a user or post if a given record has a Status column value with higher priority than the user's voter_registration_status field or their voter registration post's status field.

However, once we modify this job to update the SMS preferences for users we import -- it will be important to NOT re-import a row, as the user might unsubscribe from SMS by the time we re-import the row. Our automated import may end up fetching a row a second time, because we purposely look for rows 30 minutes before the last job finished -- in order to avoid potentially missing rows in between jobs (see #139).

Relevant tickets

Prep work for subscribing existing users in Pivotal #171848124.

Checklist