Skip to content

Commit

Permalink
Merge pull request #572 from biocore/csymons_block_shipping_emails
Browse files Browse the repository at this point in the history
Block Shipping Emails on Staging
  • Loading branch information
wasade authored May 2, 2024
2 parents cfdefca + 9f4e0e3 commit dd07e0a
Showing 1 changed file with 16 additions and 13 deletions.
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

0 comments on commit dd07e0a

Please sign in to comment.