Skip to content

Commit

Permalink
Updating publish engagement email (#2195)
Browse files Browse the repository at this point in the history
* Changes to show all survey results to superusers

* removing hard coded values

* fixing linting

* splitting to seperate end points

* fixing auth check

* fixing linting

* merging method in service

* Handle no data error for graphs

* adding new nodata component

* adding new email for submission response

* fixing linting and testing

* Upgrades to Issue Tracking Table

* removing try catch

* email upgrades

* reverting
  • Loading branch information
VineetBala-AOT authored Sep 15, 2023
1 parent 99891d1 commit 6273280
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion met-api/templates/publish_engagement.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>A new engagement is now open {% if is_having_project %} for {% endif %} {% if is_not_having_project %} on {% endif %} {{ project_name }}.</h1>
<h1>A new engagement is now open for {{ project_name }}.</h1>
<br />
<p>To learn more and provide your feedback during this public comment period, please click the link below:</p>
<br />
Expand Down
12 changes: 4 additions & 8 deletions met-cron/src/met_cron/services/mail_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,21 @@ def _render_email_template(engagement, participant, template):
site_url = notification.get_tenant_site_url(engagement.tenant_id)
tenant_name = EmailService._get_tenant_name(engagement.tenant_id)
metadata_model: EngagementMetadataModel = EngagementMetadataModel.find_by_id(engagement.id)
project_name = metadata_model.project_metadata.get('project_name', None)
is_having_project = True if project_name else False
is_not_having_project = True if not project_name else False
project_name = None
if metadata_model and 'project_name' in metadata_model.project_metadata:
project_name = metadata_model.project_metadata.get('project_name')
view_path = current_app.config.get('ENGAGEMENT_VIEW_PATH'). \
format(engagement_id=engagement.id)
unsubscribe_url = current_app.config.get('UNSUBSCRIBE_PATH'). \
format(engagement_id=engagement.id, participant_id=participant.id)
email_environment = current_app.config.get('EMAIL_ENVIRONMENT', '')
args = {
'project_name': project_name if project_name else tenant_name,
'project_name': project_name if project_name else engagement.name,
'survey_url': f'{site_url}{view_path}',
'end_date': datetime.strftime(engagement.end_date, EmailVerificationService.full_date_format),
'tenant_name': tenant_name,
'email_environment': email_environment,
'unsubscribe_url': f'{site_url}{unsubscribe_url}',
'is_having_project': is_having_project,
'is_not_having_project': is_not_having_project,
}
body = template.render(
project_name=args.get('project_name'),
Expand All @@ -79,8 +77,6 @@ def _render_email_template(engagement, participant, template):
tenant_name=args.get('tenant_name'),
email_environment=args.get('email_environment'),
unsubscribe_url=args.get('unsubscribe_url'),
is_having_project=args.get('is_having_project'),
is_not_having_project=args.get('is_not_having_project'),
)
return body, args

Expand Down

0 comments on commit 6273280

Please sign in to comment.