Skip to content

Commit

Permalink
[#2717] Limit instructor confirmed for workshop email
Browse files Browse the repository at this point in the history
This email is now only sent to centrally-organised workshops.
  • Loading branch information
pbanaszkiewicz committed Nov 7, 2024
1 parent 53b22b1 commit 2fd733e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion amy/emails/actions/instructor_confirmed_for_workshop.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,23 @@ def instructor_confirmed_for_workshop_strategy(task: Task) -> StrategyEnum:
carpentries_tags = task.event.tags.filter(
name__in=TagQuerySet.CARPENTRIES_TAG_NAMES
).exclude(name__in=TagQuerySet.NON_CARPENTRIES_TAG_NAMES)
centrally_organised = (
task.event.administrator and task.event.administrator.domain != "self-organized"
)

log_condition_elements(
instructor_role=instructor_role,
person_email_exists=person_email_exists,
carpentries_tags=carpentries_tags,
centrally_organised=centrally_organised,
)

email_should_exist = (
task.pk and instructor_role and person_email_exists and carpentries_tags
task.pk
and instructor_role
and person_email_exists
and carpentries_tags
and centrally_organised
)
logger.debug(f"{email_should_exist=}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ class TestInstructorConfirmedForWorkshopStrategy(TestCase):
def setUp(self) -> None:
host = Organization.objects.create(domain="test.com", fullname="Test")
self.event = Event.objects.create(
slug="test-event", host=host, start=date(2024, 8, 5), end=date(2024, 8, 5)
slug="test-event",
host=host,
administrator=host,
start=date(2024, 8, 5),
end=date(2024, 8, 5),
)
swc_tag = Tag.objects.create(name="SWC")
self.event.tags.set([swc_tag])
Expand Down

0 comments on commit 2fd733e

Please sign in to comment.