OperationCode / operationcode_backend

This is the backend repo for the Operation Code website
https://operationcode.org
MIT License
62 stars 110 forks source link

Create alert email for leaders if someone signs up within 50 miles #292

Closed nagano564 closed 6 years ago

nagano564 commented 6 years ago

Description of changes

This should send an email to leaders if a new user signs up within 50 miles of the leader

Issue Resolved

Fixes #37

ramillim commented 6 years ago

@nagano564 I rewrote the test because I discovered that running a .count on the ActiveRecord relation after the geo-query causes the query to break (appeared to be a table alias related to the Geocoder gem).

Before we reconvene, make sure you git pull the last commit I pushed and then 'git fetch upstream' and rebase it with master. @hpjaj added a constant for the 'community leader' tag and a has_tag? method on User model.

hpjaj commented 6 years ago

Also looks like CI turned up a couple errors. You can click the Travis CI link above, and search for "errors" to see the issues.

You can also run make test locally, to see the errors.

ramillim commented 6 years ago

@hpjaj We were just checkpointing it earlier today since we had to work on other things. Currently pairing on slack's screenhero right now, adding more tests for UserMailer right now.

nagano564 commented 6 years ago

Should we send each leader a email individually

Or have one email sent to all leaders in the area if we send it this way should we worry about having all the emails on the BCC line so other leaders can't see each others email addresses in the to line.

ramillim commented 6 years ago

@hpjaj this is ready for review whenever you get a chance, and also wondering if we want to change the mailer implementation per @nagano564 's latest comment.

hpjaj commented 6 years ago

This looks good!

Should we send each leader a email individually

Yes.

We need a rake task to initially tag the appropriate users in prod with the community leader tag. This would involve:

  1. Collaborating with @hollomancer (or whomever he deems appropriate) to determine what prod users should be tagged
  2. Creating the rake task

Would you like to include that as part of this PR and issue? Or create a new issue and PR for it?

hpjaj commented 6 years ago

Creating a separate issue for the rake task.