HackRVA / memberdashboard

Member Dashboard is the source of truth for who has access to what at the makerspace.
MIT License
4 stars 2 forks source link

grace period emails seem to be resending occasionally #122

Open dfirebaugh opened 3 years ago

dfirebaugh commented 3 years ago

This could be related or simlar to https://github.com/HackRVA/memberdashboard/issues/108

Athulus commented 3 years ago

it looks like the grace period email will resend every day between grace period start and the membership changing to inactive. does that look right to you @dfirebaugh ?

this runs every 25 hours :point_down:

               if a.DaysSinceLastPayment > memberGracePeriod {
            mailer.SendCommunication(mail.AccessRevokedLeadership, c.AdminEmail, a)
            mailer.SendCommunication(mail.AccessRevokedMember, a.Email, a)
            db.SetMemberLevel(a.MemberId, models.Inactive)
        } else if a.DaysSinceLastPayment > membershipMonth {
            if !mailer.IsThrottled(pendingRevokation, models.Member{ID: a.MemberId}) {
                //TODO: [ML] Does it make sense to send this to leadership?  It might be like spam...
                mailer.SendCommunication(mail.PendingRevokationLeadership, c.AdminEmail, a)
                mailer.SendCommunication(mail.PendingRevokationMember, a.Email, a)
            }
        }

I was thinking that adding a boolean field to the getPastDuePayments query that tracks if they have been sent a grace period email would work. That would require adding that boolean field to the member table. We would have to set the flag after the PendingRevokationMember email is sent and clear that flag on payment received.

how does that sound?

dfirebaugh commented 3 years ago

That sounds good to me.