Skip to content

WIP: Balance mailing#24

Open
AlexandrePalo wants to merge 4 commits intodevelopfrom
balance_mailing
Open

WIP: Balance mailing#24
AlexandrePalo wants to merge 4 commits intodevelopfrom
balance_mailing

Conversation

@AlexandrePalo
Copy link
Copy Markdown
Member

@AlexandrePalo AlexandrePalo commented Feb 15, 2018

Balance mailing

From branch settings

!!! Still in progress !!!

The following is not committed yet

Question

How to manage email sent to users for the balance ?

The issue is that the balance, the threshold and the frequency can change easily.

What I suggest

  • A new attribute last_balance_mail_alert, type Datetime which contains the last date & time when an email was sent to the user concerning its balance.
  • Every day (in the night for instance), a code checks for every user with a balance under the threshold. Then we check last_balance_mail_alert: if it's None (nothing was ever send) an email is sent, if it's under the current date minus the frequency setting send an email too and do nothing else.
  • Every time an email is sent, update last_balance_mail_alert to current datetime.
  • Each time a debit or a credit is made for an user, check if the balance goes from under to over the threshold (and the inverse too). If yes, set the last_balance_mail_alert to None (reset). Thus, the next day when the balance will be checked: if you're under the threshold and the attribute is None, it means that no mail was sent for this case so send one. If you're no under the threshold, nothing is sent anyways (last_balance_mail_alert doesn't matter).
  • Each time the threshold is changed in settings, do the same thing to reset or not last_balance_mail_alert.

@maellacour maellacour changed the title Balance mailing WIP WIP: Balance mailing Jun 3, 2018
@VincentKeppens VincentKeppens removed this from the REX Birse milestone Nov 10, 2018
@maellacour maellacour changed the base branch from master to develop November 29, 2018 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants