-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes for automated emails (#2138)
* 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 * Changes for automated emails * fixing linting * updating indent style
- Loading branch information
1 parent
e217261
commit b17c8d0
Showing
21 changed files
with
376 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<h1>The public comment period for {{ project_name }} will close on {{ end_date }} at midnight, Pacific time.</h1> | ||
<br /> | ||
<p>If you would like to provide your feedback, please do so before the date noted above.</p> | ||
<br /> | ||
<p>If you have already provided feedback, thank you! You may ignore this email.</p> | ||
<br /> | ||
<p><a href="{{ survey_url }}">Provide Your Feedback</a></p> | ||
<br /> | ||
<p>Thank you,</p> | ||
<br /> | ||
<p>The {{ tenant_name }} Team</p> | ||
<br /> | ||
<p>If you would no longer like to receive updates from us, you may <a href='{{ unsubscribe_url }}'>unsubscribe</a>.</p> | ||
<br /> | ||
<p>{{email_environment}}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<h1>Thank you for subscribing to our feedback tool.</h1> | ||
<h1>A new engagement is now open {% if is_having_project %} for {% endif %} {% if is_not_having_project %} on {% endif %} {{ project_name }}.</h1> | ||
<br /> | ||
<p>This is to update you that a new engagement, {{ engagement_name }}, has been published.</p> | ||
<p>To learn more and provide your feedback during this public comment period, please click the link below:</p> | ||
<br /> | ||
<p>Please visit the<p> | ||
<a href='{{ link }}'>link</a> | ||
<p>to learn more and provide your feedback.<p> | ||
<p><a href="{{ survey_url }}">Provide Your Feedback</a></p> | ||
<br /> | ||
<p>The public comment period ends on {{ end_date }}.</p> | ||
<br /> | ||
<p>Thank you,</p> | ||
<br /> | ||
<p>The Team at the Environmental Assessment Office</p> | ||
<p>The {{ tenant_name }} Team</p> | ||
<br /> | ||
<p>If you would no longer like to receive updates from us, you may <a href='{{ unsubscribe_url }}'>unsubscribe</a>.</p> | ||
<br /> | ||
<p>{{email_environment}}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#! /bin/sh | ||
echo 'run invoke_jobs.py CLOSING_SOON_EMAIL' | ||
python3 invoke_jobs.py CLOSING_SOON_EMAIL |
26 changes: 26 additions & 0 deletions
26
met-cron/src/met_cron/services/closing_soon_mail_service.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from flask import current_app | ||
from met_api.models.engagement import Engagement as EngagementModel | ||
from met_api.utils.template import Template | ||
from met_cron.services.mail_service import EmailService | ||
|
||
|
||
class ClosingSoonEmailService: # pylint: disable=too-few-public-methods | ||
"""Mail for newly published engagements""" | ||
|
||
@staticmethod | ||
def do_mail(): | ||
"""Send mail by listening to the email_queue. | ||
1. Get N number of unprocessed recoreds from the email_queue table | ||
2. Process each mail and send it to subscribed users | ||
""" | ||
engagements_closing_soon = EngagementModel.get_engagements_closing_soon() | ||
template_id = current_app.config.get('ENGAGEMENT_CLOSING_SOON_EMAIL_TEMPLATE_ID', None) | ||
subject = current_app.config.get('ENGAGEMENT_CLOSING_SOON_EMAIL_SUBJECT') | ||
template = Template.get_template('engagement_closing_soon.html') | ||
for engagement in engagements_closing_soon: | ||
# Process each mails.First set status as PROCESSING | ||
|
||
EmailService._send_email_notification_for_subscription(engagement.id, template_id, | ||
subject, template) |
Oops, something went wrong.