Skip to content

Commit

Permalink
another guard clause, still puzzling over attempt to send reminder em…
Browse files Browse the repository at this point in the history
…ail to all opted out case.
  • Loading branch information
pbugni committed May 1, 2024
1 parent 774d88d commit 220b991
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion portal/trigger_states/empro_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ def process_pending_actions(ts):
f"Invalid action_state {ts.triggers['action_state']} "
f"for patient {ts.user_id}")

if not ts.hard_trigger_list():
raise ValueError(f"{ts.user_id} should not require action without any hard triggers")

patient = User.query.get(ts.user_id)

# Withdrawn users should never receive reminders, nor staff
Expand All @@ -375,7 +378,10 @@ def process_pending_actions(ts):

if ts.reminder_due():
pending_emails = staff_emails(
patient, ts.hard_trigger_list(), ts.opted_out_domains(), False)
patient=patient,
hard_triggers=ts.hard_trigger_list(),
opted_out_domains=ts.opted_out_domains(),
initial_notification=False)

# necessary to make deep copy in order to update DB JSON
triggers = copy.deepcopy(ts.triggers)
Expand Down

0 comments on commit 220b991

Please sign in to comment.