Skip to content

Commit

Permalink
Merge pull request #74 from UCL-ARC/stef/remove_whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
stefpiatek authored Oct 27, 2023
2 parents 1237d06 + a0ebf1e commit 4c1640c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Binary file modified input/templates/2022/2022-23_template.docx
Binary file not shown.
8 changes: 7 additions & 1 deletion src/rred_reports/dispatch_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_mailing_info(rred_school_id: str, dispatch_list: Path, override_mailto:

# Case 2: Find instances of multiple teacher emails
# Remove any space-delimited lists and replace with comma separated
cleaned_mailing_list = teacher_and_leader_dispatch.loc[:, "Mailing List"].str.replace(" ", ",").str.replace(",,", ",")
cleaned_mailing_list = teacher_and_leader_dispatch.loc[:, "Mailing List"].str.rstrip(" ").str.replace(" ", ",").str.replace(",,", ",")
teacher_and_leader_dispatch.loc[:, "Mailing List"] = cleaned_mailing_list
mailing_info = teacher_and_leader_dispatch.loc[:, ["RRED School ID", "School Label", "Mailing List"]]

Expand All @@ -106,7 +106,13 @@ def get_mailing_info(rred_school_id: str, dispatch_list: Path, override_mailto:

school_id = mailing_info["RRED School ID"].unique()[0]
school_label = mailing_info["School Label"].tolist()[0]
mailing_list = mailing_info["Mailing List"].str.rstrip(",").tolist()
mailing_list = mailing_info["Mailing List"].tolist()

if any("," in email for email in mailing_list):
message = f"Comma found in at least one of the emails {mailing_list}"
raise DispatchListException(message)

if override_mailto:
mailing_list = [override_mailto]

Expand Down

0 comments on commit 4c1640c

Please sign in to comment.