americanhandelsociety / americanhandelsociety-members

0 stars 0 forks source link

Are the emails for members with overdue payments simply going to continue? #172

Closed reginafcompton closed 12 months ago

reginafcompton commented 1 year ago

From @ecedmondson:

Are the emails for members with overdue payments simply going to continue? Is there a “pay by” date? ^

Yes, they will just continue (though I did not look at the code to refresh my memory).

They probably should not, and some sort of action should happen, e.g., the AHS revokes membership. (I have a vague memory that members can take a full year to pay dues before this happens.)

ecedmondson commented 1 year ago

Had a background process thought about this: shouldn't we see what the AHS board says?

reginafcompton commented 1 year ago

Yes...sorry: that would be part of the work for this ticket.

reginafcompton commented 1 year ago

I.e., I can take the lead on figuring out the requirements for this!

reginafcompton commented 1 year ago

The AHS board met today, and I asked about the course of action here. They decided:

  1. members who have not paid for the last year will receive a final notice in December via the automated email. Could we potentially send a different email in December by adjusting here? https://github.com/americanhandelsociety/americanhandelsociety-members/blob/c18845ad8a3edecd4f0a1cb699aeef7b7d744f18/americanhandelsociety_app/management/commands/send_overdue_payment_email.py#L42 Or we could setup another Heroku scheduler for a different command.....but that seems like more work. Ha. @ecedmondson - do you have any interest in taking this? ....it should be an adjustment we make before December 1 – could that fit into your schedule?
  2. an AHS admin will deactivate accounts in January/February (after the winter newsletters are mailed).

(Notes from the meeting for reference: https://docs.google.com/document/d/1WcD5FzeKoDLKX12PRo1NRrOtr7L6W8ZWC2EdWdpeeKk/edit)

ecedmondson commented 1 year ago

Any chance you have copy for the final notice?

reginafcompton commented 1 year ago

Oh, we can just make it up ourselves! (And then I'll ask the newsletter editor for final review.)

Your AHS membership will be deactivated in {dynamically calculate the next year?} if you do not submit your annual payment before the end of {this year}.

I think we can include this phrase somewhere in the existing email, but only include it for those that go out on December 1.

Also: we should figure out what happens in January: Two things:

ecedmondson commented 1 year ago

I think we can include this phrase somewhere in the existing email, but only include it for those that go out on December 1.

Sounds good.

we need to look at how the code handles members delinquent in, say, 2023 going into 2024.....

I'm not entirely sure what you had in mind here. If we want to keep it simple we could do something like this:

class MemberManager(BaseUserManager):
     # ... redacted already existing qs methods

    def with_delinquency(self):
        # assuming these three here
        # delinquent - payment date is < last calendar year
        # pending - payment date is last calendar year
        # paid - payment date is this calendar year
        return self.annotate(
            _delinquency=models.Case(
                models.When(date_of_last_membership_payment__year__lt=year_now() - 1, then=models.Value('delinquent')),
                models.When(date_of_last_membership_payment__year=year_now() - 1, then=models.Value('pending')),
                models.When(date_of_last_membership_payment__year=year_now(), then=models.Value('paid')),
                default=None,
                output_field=models.CharField(),
            )
        )

    def members_with_overdue_payments(self):
         # this mostly already exists in the e-mail code. updated to account for delinquency. i think it belongs on the manager though.
        return self.with_delinquency().exclude(
            Q(membership_type=Member.MembershipType.MESSIAH_CIRCLE) | Q(is_member_via_other_organization=True )
        ).filter(_delinquency="pending")

Or you could do another field on the class that you keep in sync with date_of_last_membership_payment. Might be useful if you need a more proper state for other use-cases.

we also might want to disable emails entirely in January, since a January 1 "you are late" email might not make sense? I guess I should look at the email template itself.

Yeah, I think it doesn't make sense to send an overdue notice in January. What about a new year of membership renewals due e-mail? A happy one, excited for a new year of musical academe?

Either way, I think the easy thing to do here is simply make the existing command do something else when now().month == 1. Either skip entirely or send different content.

ecedmondson commented 1 year ago

Also, I have a question about this:

{dynamically calculate the next year?} I am assuming you mean that the code should dynamically calculate this value so that this code is reusable in the next December of the Gregorian calendar?

ecedmondson commented 1 year ago

Since this idea was easy enough, I have an example of what it might look like: https://github.com/americanhandelsociety/americanhandelsociety-members/tree/172.suggestion

Haven't written tests because I'm still not sure what you had in mind for the whole we need to look at how the code handles members delinquent in, say, 2023 going into 2024 part. I can if this code is sufficient.

reginafcompton commented 1 year ago

we need to look at how the code handles members delinquent in, say, 2023 going into 2024

So, the answer is: it did not. Ha. But now it does! (Thanks to the work you just pushed. Thank you!)

And yes, I agree with your approach: the very last email the AHS sends to such members will be in 2023. They will not receive additional automated emails after that.

What about a new year of membership renewals due e-mail? A happy one, excited for a new year of musical academe?

I believe that the President of AHS handles this with a society-wide email. I think that the newsletter editor does something similar. Soooo....we do not need to worry about it on our end.


Finally: your submitted commit looks fantastic! MASSIVE THANKS for tackling this! I left just a few small comments to consider.

ecedmondson commented 1 year ago

I believe that the President of AHS handles this with a society-wide email. I think that the newsletter editor does something similar. Soooo....we do not need to worry about it on our end.

Sounds good.

I pushed up some changes to remove the annotation and add tests. I have not assigned it out because I lost track of time and need to skedaddle. I would like to look at one test again before assigning out the PR.

Do you think this needs a staging test or nah?

reginafcompton commented 1 year ago

I would like to look at one test again before assigning out the PR.

Argh! I missed this. Sorry for the premature review.

reginafcompton commented 1 year ago

Do you think this needs a staging test or nah?

naaaaaaah

reginafcompton commented 12 months ago

Closing! Thanks, Emily!