Skip to content

Commit

Permalink
Add case names to the delivery messages (#3911) (patch)
Browse files Browse the repository at this point in the history
### Added

- Information on what cases the delivery message was generated for.
  • Loading branch information
islean authored Nov 6, 2024
1 parent b61dcc0 commit 3ce3f35
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion cg/services/delivery_message/messages/analysis_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@

def get_cases_message(cases: list[Case]) -> str:
delivery_path: str = get_caesar_delivery_path(cases[0])
case_names: str = "\n".join([case.name for case in cases])
case_s_: str = "case" if len(cases) == 1 else "cases"
return (
f"Hello,\n\n"
f"The analysis files are currently being uploaded to your inbox on Caesar:\n\n"
f"The analysis files for the following {case_s_} are currently being uploaded to your inbox on Caesar:\n\n"
f"{case_names}\n\n"
f"Available under: \n\n"
f"{delivery_path}"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
class FastqAnalysisMessage(DeliveryMessage):
def create_message(self, cases: list[Case]) -> str:
delivery_path: str = get_caesar_delivery_path(cases[0])
case_names: str = "\n".join([case.name for case in cases])
case_s_: str = "case" if len(cases) == 1 else "cases"
return (
f"Hello,\n\n"
f"The fastq and analysis files are currently being uploaded to your inbox on Caesar:\n\n"
f"The fastq and analysis files for the following {case_s_} are currently being uploaded to your inbox on Caesar:\n\n"
f"{case_names}\n\n"
f"Available under: \n"
f"{delivery_path}"
)
7 changes: 6 additions & 1 deletion cg/services/delivery_message/messages/fastq_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
class FastqMessage(DeliveryMessage):
def create_message(self, cases: list[Case]) -> str:
delivery_path: str = get_caesar_delivery_path(cases[0])
sample_names: str = "\n".join([sample.name for case in cases for sample in case.samples])
number_of_samples: int = sum(len(case.samples) for case in cases)
sample_s_: str = "sample" if number_of_samples == 1 else "samples"
return (
f"Hello,\n\n"
f"The fastq files for this order have been uploaded to your inbox on Caesar at:\n\n"
f"The fastq files for the following {sample_s_} have been uploaded to your inbox on Caesar:\n\n"
f"{sample_names}\n\n"
"Available under: \n\n"
f"{delivery_path}"
)

0 comments on commit 3ce3f35

Please sign in to comment.