Skip to content

Commit

Permalink
Merge pull request #2718 from carpentries/feature/2717-limit-instruct…
Browse files Browse the repository at this point in the history
…or-confirmed-for-workshop-to-centrally-org-only

[Emails] Limit instructor confirmed for workshop email
  • Loading branch information
pbanaszkiewicz authored Nov 7, 2024
2 parents 53b22b1 + 2fd733e commit 73d48e0
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 73d48e0

Please sign in to comment.