FoveaCentral / vaccinesignup

A Twitter bot that notifies users about available vaccine appointments
https://twitter.com/vaccinesignup
Creative Commons Zero v1.0 Universal
2 stars 0 forks source link

Fix DMs by sync_and_notify #25

Closed ivanoblomov closed 3 years ago

ivanoblomov commented 3 years ago

Bug Report

Description

The vaccinesignup:sync_and_notify task (which calls SyncBot) is flawed, because it attempts to DM subscribed users after any Locations are created or updated, regardless of whether those specific zip codes were followed.

Steps to Reproduce

  1. Run rake vaccinesignup:sync_and_notify.
  2. The sent DMs don't correspond to the updated Locations.

Expected behavior

If a given Location gets updated, then the outgoing DM should contain all the Locations in the same zip code.

Additional context

The app currently DMs appointment-locations under two conditions:

  1. After parsing TWITTER_CLIENT.direct_messages_received for zip codes.
  2. After syncing Locations with LA County and finding new/updated Locations.

Since the streaming version of the bot will handle context 1, we just need a new task that DMs all the appointment-locations in the zip code of any updated Location.

ivanoblomov commented 3 years ago

@wraasch what do you think of the expected behavior above? I think this is in line with what we discussed, but want to make sure before potentially going down the wrong path.