From 63df614f4198ce3c29882fc1a8aa1df8bdcd070e Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Tue, 12 Oct 2021 13:43:29 -0400 Subject: [PATCH] Change workflow_id to workflow_spec_id --- crc/scripts/email.py | 4 +++- crc/services/email_service.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crc/scripts/email.py b/crc/scripts/email.py index 22fdac9c..bca72827 100644 --- a/crc/scripts/email.py +++ b/crc/scripts/email.py @@ -66,6 +66,8 @@ email(subject="My Subject", recipients="user@example.com", attachments=['Study_A message="Email script requires a subject and at least one email recipient as arguments") if recipients: + wf_model = session.query(WorkflowModel).filter(WorkflowModel.id == workflow_id).first() + workflow_spec_id = wf_model.workflow_spec_id message = task.task_spec.documentation data = task.data try: @@ -81,7 +83,7 @@ email(subject="My Subject", recipients="user@example.com", attachments=['Study_A study_id=study_id, reply_to=reply_to, attachment_files=files, - workflow_id=workflow_id + workflow_spec_id=workflow_spec_id ) except Exception as e: exc_type, exc_value, exc_traceback = sys.exc_info() diff --git a/crc/services/email_service.py b/crc/services/email_service.py index 1f01e423..8e341c8d 100644 --- a/crc/services/email_service.py +++ b/crc/services/email_service.py @@ -17,7 +17,7 @@ class EmailService(object): @staticmethod def add_email(subject, sender, recipients, content, content_html, - cc=None, bcc=None, study_id=None, reply_to=None, attachment_files=None, workflow_id=None): + cc=None, bcc=None, study_id=None, reply_to=None, attachment_files=None, workflow_spec_id=None): """We will receive all data related to an email and store it""" # Find corresponding study - if any @@ -28,7 +28,7 @@ class EmailService(object): # Create EmailModel email_model = EmailModel(subject=subject, sender=sender, recipients=str(recipients), content=content, content_html=content_html, study=study, - cc=cc, bcc=bcc, workflow_id=workflow_id) + cc=cc, bcc=bcc, workflow_spec_id=workflow_spec_id) # Send mail try: