-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat(invitation_email): add new scheduler after seven days #468
Open
gaspard-lonchampt
wants to merge
2
commits into
master
Choose a base branch
from
feat/invitation_email_after_7_days
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from datetime import timedelta | ||
|
||
from app import app, mailer | ||
from app.domain.company import find_employee_for_invitation | ||
from app.jobs import log_execution | ||
|
||
NB_DAYS_AGO = 7 | ||
|
||
|
||
@log_execution | ||
def send_invitation_emails(today): | ||
app.logger.info("Starting the invitation email sending process.") | ||
|
||
trigger_date = today - timedelta(days=NB_DAYS_AGO) | ||
|
||
employments = find_employee_for_invitation(trigger_date) | ||
app.logger.info( | ||
f"Found {len(employments)} employments for sending invitations." | ||
) | ||
|
||
if employments: | ||
try: | ||
mailer.batch_send_employee_invites( | ||
employments, reminder=False, scheduled_reminder=True | ||
) | ||
app.logger.info(f"Emails sent for {len(employments)} employments.") | ||
except Exception as e: | ||
app.logger.error("Error during batch email sending.") | ||
app.logger.exception(e) | ||
|
||
app.logger.info("Finished the invitation email sending process.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
{% extends "transactional_base.html" %} | ||
{% import 'button.html' as button %} | ||
|
||
{% block subject %} | ||
{{ company_name }} vous invite à rejoindre Mobilic | ||
{% endblock %} | ||
|
||
{% block body %} | ||
<p>Bonjour{% if first_name %} {{first_name | capitalize}}{% endif %},</p> | ||
{% if not first_name %} | ||
<p>Bonjour{% if first_name %} {{ first_name | capitalize }}{% endif %},</p> | ||
{% if scheduled_reminder %} | ||
<p>L'entreprise <strong>{{ company_name | upper }}</strong> vous rappelle que vous avez été invité à créer votre compte | ||
sur <strong>Mobilic</strong>, l'outil numérique pour suivre et protéger vos droits en tant que salarié.</p> | ||
<p>Grâce à <strong>Mobilic</strong>, vous pourrez facilement :</p> | ||
<ul> | ||
<li>Enregistrer vos heures de travail en toute simplicité</li> | ||
<li>Assurer le respect de vos droits au quotidien</li> | ||
</ul> | ||
<p><strong>Il vous suffit de quelques clics pour activer votre compte et être prêt(e) à l'utiliser ! </strong></p> | ||
<p>Cliquez sur le bouton ci-dessous pour créer votre compte ou l'associer à <strong>{{ company_name | upper }}</strong> :</p> | ||
{{ button.button('Activer mon compte', invitation_link) }} | ||
<p><strong>Petit rappel important :</strong> L’enregistrement de votre temps de travail via Mobilic ou le livret | ||
individuel de contrôle (LIC) est obligatoire dans votre secteur.</p> | ||
<p>À très bientôt sur Mobilic !</p> | ||
{% else %} | ||
<p> | ||
{% if reminder %} | ||
L'entreprise <strong>{{company_name | upper}}</strong> vous rappelle que vous avez été invité | ||
L'entreprise <strong>{{ company_name | upper }}</strong> vous rappelle que vous avez été invité | ||
{% else %} | ||
Vous avez été invité(e) par l’entreprise <strong>{{company_name | upper}}</strong> | ||
Vous avez été invité(e) par l’entreprise <strong>{{ company_name | upper }}</strong> | ||
{% endif %} à créer un compte Mobilic pour enregistrer votre temps de travail.</p> | ||
<p>Mobilic est la plateforme gouvernementale qui simplifie <strong>l'enregistrement et le suivi du temps de travail</strong> des travailleurs mobiles du transport routier léger et du déménagement.</p> | ||
<p>Pour créer votre compte ou rattacher votre compte existant à l'entreprise <strong>{{company_name | upper}}</strong> cliquez sur le bouton d'activation suivant :</p> | ||
{{button.button('Activer mon compte', invitation_link)}} | ||
{% else %} | ||
<p> | ||
{% if reminder %} | ||
L'entreprise <strong>{{company_name | upper}}</strong> vous rappelle que vous avez été invité à la rejoindre | ||
{% else %} | ||
Vous avez été invité(e) à rejoindre l'entreprise <strong>{{company_name | upper}}</strong> | ||
{% endif %} sur Mobilic. | ||
</p> | ||
<p>Pour rattacher votre compte à l'entreprise <strong>{{company_name | upper}}</strong> cliquez sur le bouton d'activation suivant :</p> | ||
{{button.button('Activer mon compte', invitation_link)}} | ||
<p>Pour créer votre compte ou rattacher votre compte existant à l'entreprise <strong>{{ company_name | upper }}</strong> cliquez sur le bouton d'activation suivant :</p> | ||
{{ button.button('Activer mon compte', invitation_link) }} | ||
{% endif %} | ||
<p>Bien à vous,</p> | ||
{% endblock %} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 je me demande juste s'il ne faudrait pas s'assurer qu'on n'a pas déjà envoyé l'email de relance à cette personne ? Car vu qu'on regarde ceux qui ont reçu l'autre email il y a au moins 7 jours, il risque de recevoir le rappel tous les jours non ?