Skip to content

Commit

Permalink
Update conditions for migrating old automated emails
Browse files Browse the repository at this point in the history
The condition didn't respect RQJobs in "scheduled" state.
  • Loading branch information
pbanaszkiewicz committed Oct 26, 2024
1 parent 385d1a7 commit 88b7d2a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ def _check_conditions(
logger.info(f"RQJob for {event=}, {trigger_action=}: {rqjob}")

strategy_result = strategy(event)
return strategy_result == StrategyEnum.CREATE and not rqjob
return bool(
strategy_result == StrategyEnum.CREATE
and rqjob
and rqjob.status == "scheduled"
) or bool(strategy_result == StrategyEnum.CREATE and not rqjob)

@override_settings(FLAGS={"EMAIL_MODULE": [("boolean", True)]})
@transaction.atomic
Expand Down

0 comments on commit 88b7d2a

Please sign in to comment.