Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
last_balance_mail_alert
, typeDatetime
which contains the last date & time when an email was sent to the user concerning its balance.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.last_balance_mail_alert
to current datetime.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).last_balance_mail_alert
.