Skip to content

Commit 43dd7d5

Browse files
committed
Tweaked the management command to send GDPR consent request emails to correctly perform exclusion based on the time of previous consent request emails.
- Legacy-Id: 15504
1 parent 5318c03 commit 43dd7d5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ietf/utils/management/commands/send_gdpr_consent_request.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def handle(self, *args, **options):
6868
if 'user' in options and options['user']:
6969
persons = Person.objects.filter(user__username__in=options['user'])
7070
else:
71-
persons = Person.objects.exclude(consent=True).exclude(personevent__time__gt=latest_previous, personevent__type=event_type)
71+
exclude = PersonEvent.objects.filter(time__gt=latest_previous, type=event_type)
72+
persons = Person.objects.exclude(consent=True).exclude(personevent__in=exclude)
7273
# Report the size of the run
7374
runtime = persons.count() * delay
7475
self.stdout.write('Sending to %d users; estimated time a bit more than %d:%02d hours' % (persons.count(), runtime//3600, runtime%3600//60))
@@ -93,3 +94,4 @@ def handle(self, *args, **options):
9394
e = PersonEvent.objects.create(person=person, type='gdpr_notice_email',
9495
desc="Sent GDPR notice email to %s with confirmation deadline %s" % (to, date))
9596
time.sleep(delay)
97+

0 commit comments

Comments
 (0)