Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Shipping Emails on Staging #572

Merged
merged 1 commit into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions microsetta_private_api/util/perk_fulfillment.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,24 @@ def process_subscription_fulfillments():
def check_shipping_updates():
with Transaction() as t:
pfr = PerkFulfillmentRepo(t)
emails_sent, error_report = pfr.check_for_shipping_updates()
pf_active = pfr.check_perk_fulfillment_active()

if emails_sent > 0 or len(error_report) > 0:
t.commit()
if pf_active:
emails_sent, error_report = pfr.check_for_shipping_updates()

email_content = f"Emails sent: {emails_sent}\n"\
f"Errors: {error_report}"
try:
send_email(SERVER_CONFIG['pester_email'], "pester_daniel",
{"what": "Automated Tracking Updates Output",
"content": email_content},
EN_US)
except: # noqa
# try our best to email
pass
if emails_sent > 0 or len(error_report) > 0:
t.commit()

email_content = f"Emails sent: {emails_sent}\n"\
f"Errors: {error_report}"
try:
send_email(SERVER_CONFIG['pester_email'], "pester_daniel",
{"what": "Automated Tracking Updates Output",
"content": email_content},
EN_US)
except: # noqa
# try our best to email
pass


@celery.task(ignore_result=True)
Expand Down
Loading