Skip to content

Commit

Permalink
fix query for appointment reminders (closes #229)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbonf committed Oct 1, 2024
1 parent fe2066b commit 45b7afc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lab/experiments/management/commands/send_reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ class Command(BaseCommand):
def handle(self, *args, **options):
# fetch appoinments 24 hours from now
now = datetime.now()
threshold = now + timedelta(days=1)
threshold_from = now + timedelta(days=1)
threshold_to = now + timedelta(days=2)

appointments = Appointment.objects.filter(
timeslot__start__gt=now, timeslot__start__lte=threshold, reminder_sent=None
)
timeslot__start__gt=threshold_from, timeslot__start__lte=threshold_to, reminder_sent=None
).exclude(outcome=Appointment.Outcome.CANCELED)

for appointment in appointments:
mail = TemplateEmail(
Expand Down

0 comments on commit 45b7afc

Please sign in to comment.