Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Balance mailing #24

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

WIP: Balance mailing #24

wants to merge 4 commits into from

Conversation

AlexandrePalo
Copy link
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.

@Eyap53 Eyap53 changed the title Balance mailing WIP WIP: Balance mailing Jun 3, 2018
@VincentKeppens VincentKeppens removed this from the REX Birse milestone Nov 10, 2018
@Eyap53 Eyap53 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