Skip to content

Commit

Permalink
feat(emails): imported org name from config. Updated date to current …
Browse files Browse the repository at this point in the history
…year. thanks @paysni
  • Loading branch information
christopherpickering committed Jun 28, 2023
1 parent c60141a commit c4a46e6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions runner/scripts/em_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def __init__(
success=0,
date=date,
logs=logs,
org=app.config["ORG_NAME"],
),
short_message=task.email_error_message
or f"Atlas Hub task {task} failed.",
Expand Down
3 changes: 2 additions & 1 deletion runner/scripts/task_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ def __send_email(self) -> None:
.all()
)

date = str(datetime.datetime.now())
date = datetime.datetime.now()

# pylint: disable=broad-except
try:
Expand Down Expand Up @@ -820,6 +820,7 @@ def __send_email(self) -> None:
logs=logs,
output=output,
host=app.config["WEB_HOST"],
org=app.config["ORG_NAME"],
),
short_message=self.task.email_completion_message
or f"Atlas Hub job {self.task} completed successfully.",
Expand Down
4 changes: 2 additions & 2 deletions runner/templates/email/email.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
font-size: 35px;
margin:0;
font-weight:lighter">Atlas / Hub</h2>
<div style="color: #6c7378;font-size: 15px;">&#169; 2020 Riverside Healthcare</div>
<div style="color: #6c7378;font-size: 15px;">&#169;{{ date.year}} {{ org }}</div>
</div>
<!-- task title -->
<h3>
Project:
<a style="color: #6c7378;
text-decoration: none"
href="{{ host }}/project/{{ task.projectId }}">{{ task.project.name }}</a>
href="{{ host }}/project/{{ task.project.id }}">{{ task.project.name }}</a>
/ Task:
<a style="color: #6c7378;
text-decoration: none"
Expand Down
7 changes: 2 additions & 5 deletions runner/web/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def send_email(run_id: int, file_id: int) -> dict:

# send the file

date = str(datetime.datetime.now())
date = datetime.datetime.now()

template = env.get_template("email/email.html.j2")

Expand All @@ -235,10 +235,7 @@ def send_email(run_id: int, file_id: int) -> dict:
+ " / Task: "
+ task.name,
message=template.render(
task=task,
success=1,
date=date,
logs=[],
task=task, success=1, date=date, logs=[], org=app.config["ORG_NAME"]
),
attachments=[x.name for x in downloaded_files],
)
Expand Down

0 comments on commit c4a46e6

Please sign in to comment.