john / drive.vote

Drive the Vote arranges free rides to the polls on election day.
https://www.drive.vote/
14 stars 7 forks source link

Bulk ride upload #1051

Closed john closed 6 years ago

john commented 6 years ago

This PR lets admins upload CSV files to create scheduled rides in bulk. To do so it:

Then in a subsequent step ('schedule'), it iterates through the PotentialRide objects for the upload, and converts them to rides.

Due to the SMS origin of DtV, Rides are always associated with a Conversation (previously, an SMS Conversation would result in the creation of a Ride). Also for that reason unique, phone numbers had been required. This PR doesn't untangle Conversations, instead empty ones are created to reduce refactoring. It does relax the requirement for unique phone numbers--you can now create rides without a phone number or email--though if phone numbers are present they still have to be unique.

This needs to be reviewed as soon as possible, so please ping me anytime if it would help to step through together. More tests and validations would be nice, but since we don't have time, this will might only be run by DtV staff on behalf of partners, and we'll vet the data on the CSVs prior to running.

One requirement that's missing is that where we don't have a phone number, the ride modal shouldn't show the option to send messages. That's part of #1043, @murdzaj, we can sync on syncing those.

john commented 6 years ago

@dryan shit that was an accident, i'd hacked seeds.rb to load data into the production database and didn't mean to commit it. Should have just written a script. Will def remove, I'll sync with you.