Skip to content

Commit

Permalink
Hotfix: siae_user.full_name in Siae completion reminder task. Other f…
Browse files Browse the repository at this point in the history
…ixes. ref #753
  • Loading branch information
raphodn committed May 30, 2023
1 parent b313905 commit 80baf91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import calendar

from django.core.management.base import BaseCommand, CommandError
from django.core.management.base import CommandError
from django.utils import timezone

from lemarche.siaes.models import Siae
from lemarche.siaes.tasks import send_completion_reminder_email_to_siae
from lemarche.utils.apis import api_slack
from lemarche.utils.commands import BaseCommand


class Command(BaseCommand):
Expand Down
5 changes: 3 additions & 2 deletions lemarche/siaes/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ def set_siae_coords(model, siae):

def send_completion_reminder_email_to_siae(siae):
email_subject = "Vous avez raté des opportunités commerciales !"
siae_user_emails = siae.users.values_list("email", flat=True)
siae_user_emails = list(siae.users.values_list("email", flat=True))
recipient_list = whitelist_recipient_list(siae_user_emails)
if recipient_list:
for siae_user_email in recipient_list:
siae_user = User.objects.get(email=siae_user_email).first_name
siae_user = User.objects.get(email=siae_user_email)
recipient_name = siae_user.full_name

variables = {
"SIAE_USER_FIRST_NAME": siae_user.first_name,
"SIAE_NAME": siae.name_display,
"SIAE_URL": get_share_url_object(siae),
"SIAE_EDIT_URL": f"https://{get_domain_url()}{reverse_lazy('dashboard:siae_edit_contact', args=[siae.slug])}", # noqa
}
Expand Down

0 comments on commit 80baf91

Please sign in to comment.