Skip to content

Commit

Permalink
add get_tenant name method to submission service
Browse files Browse the repository at this point in the history
  • Loading branch information
djnunez-aot committed Aug 3, 2023
1 parent 8ca6ea9 commit 623d93f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion met-api/src/met_api/services/submission_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from met_api.utils import notification
from met_api.utils.roles import Role
from met_api.utils.template import Template
from met_api.models import Tenant as TenantModel


class SubmissionService:
Expand Down Expand Up @@ -194,6 +195,11 @@ def add_or_update_staff_note(cls, survey_id, submission_id, staff_notes):
survey_id, submission_id, staff_note)
doc.flush()

@staticmethod
def _get_tenant_name(tenant_id):
tenant = TenantModel.find_by_id(tenant_id)
return tenant.name

@staticmethod
def _create_staff_notes(survey_id, submission_id, staff_note):
doc: StaffNote = StaffNote()
Expand Down Expand Up @@ -315,7 +321,7 @@ def _render_email_template(submission: Submission, review_note, token):
survey: SurveyModel = SurveyModel.find_by_id(submission.survey_id)
engagement_name = engagement.name
survey_name = survey.name
tenant_name = EmailVerificationService._get_tenant_name(
tenant_name = SubmissionService._get_tenant_name(
engagement.tenant_id)
submission_path = current_app.config.get('SUBMISSION_PATH'). \
format(engagement_id=submission.engagement_id,
Expand Down

0 comments on commit 623d93f

Please sign in to comment.