From 5af1b7c7935e2fb1ee18faf30c04944235304b80 Mon Sep 17 00:00:00 2001 From: Eric Chan Date: Fri, 28 Apr 2023 11:59:31 -0400 Subject: [PATCH 1/3] SR-1807 Update "blast" type criteria This change makes the condition for "blast" type slightly more permissive. This catches situations where the list_name ends with something like " - Group A". --- dive_sailthru_client/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dive_sailthru_client/client.py b/dive_sailthru_client/client.py index d5ce88c..415332a 100644 --- a/dive_sailthru_client/client.py +++ b/dive_sailthru_client/client.py @@ -89,7 +89,7 @@ def _infer_dive_email_type(self, campaign): # noqa: C901 - yeah it's complicat return DiveEmailTypes.Weekender elif list_name == "Supply Chain Dive: Operations" and ("Issue" in name or "SCD: Ops v2" in name): return DiveEmailTypes.Newsletter - elif "Blast" in labels or '-blast-' in name or list_name.lower().endswith("blast list"): + elif "Blast" in labels or '-blast-' in name or "blast list" in list_name.lower(): if "QuarterBlast" in name or "Quarters Blast List" in list_name or "Quarter Blast List" in list_name: return DiveEmailTypes.QuarterBlast elif "ThirdBlast" in name or "Thirds Blast List" in list_name or "Third Blast List" in list_name: From 079bdbb69c2136431add0e898643c966db908dad Mon Sep 17 00:00:00 2001 From: Eric Chan Date: Thu, 1 Jun 2023 10:54:27 -0400 Subject: [PATCH 2/3] include blast parameter in the name as a search criteria --- dive_sailthru_client/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dive_sailthru_client/client.py b/dive_sailthru_client/client.py index 415332a..54045ba 100644 --- a/dive_sailthru_client/client.py +++ b/dive_sailthru_client/client.py @@ -89,7 +89,7 @@ def _infer_dive_email_type(self, campaign): # noqa: C901 - yeah it's complicat return DiveEmailTypes.Weekender elif list_name == "Supply Chain Dive: Operations" and ("Issue" in name or "SCD: Ops v2" in name): return DiveEmailTypes.Newsletter - elif "Blast" in labels or '-blast-' in name or "blast list" in list_name.lower(): + elif "Blast" in labels or '-blast-' in name or "blast=" in name or "blast list" in list_name.lower(): if "QuarterBlast" in name or "Quarters Blast List" in list_name or "Quarter Blast List" in list_name: return DiveEmailTypes.QuarterBlast elif "ThirdBlast" in name or "Thirds Blast List" in list_name or "Third Blast List" in list_name: From af242b65d59d685f791a0a84b239f101b1a48ee8 Mon Sep 17 00:00:00 2001 From: Eric Chan Date: Fri, 2 Jun 2023 10:39:01 -0400 Subject: [PATCH 3/3] include test with new style blast name --- .../tests/test_diveSailthruClient.py | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/dive_sailthru_client/tests/test_diveSailthruClient.py b/dive_sailthru_client/tests/test_diveSailthruClient.py index b454bec..76dc740 100644 --- a/dive_sailthru_client/tests/test_diveSailthruClient.py +++ b/dive_sailthru_client/tests/test_diveSailthruClient.py @@ -213,7 +213,29 @@ def test_infer_dive_email_type_and_brand_real_examples(self): 'expected_publication': 'CFO Dive', 'expected_type': DiveEmailTypes.ThirdBlast, 'comment': 'CFO Dive third blast', - }, + }, + { + 'input': { + 'blast_id': 31437039, + 'email_count': 54245, + 'labels': [], + 'list': 'Marketing Dive Quarter Blast List - Group B', + 'mode': 'email', + 'modify_time': 'Tue, 23 May 2023 09:20:43 -0400', + 'modify_user': 'xxx@industrydive.com', + 'name': 'client_name=Salesforce.com&pt_id=a12K50000005y8oIAA&blast=quarterblast&site=MarketingDive&send_date=05.23.2023', + 'public_url': 'link.divenewsletter.com/public/31437039', + 'schedule_time': 'Tue, 23 May 2023 09:27:00 -0400', + 'sent_count': 54245, + 'start_time': 'Tue, 23 May 2023 09:27:01 -0400', + 'status': 'sent', + 'subject': 'See how personalized marketing can lift loyalty and raise ROI', + 'suppress_list': [] + }, + 'expected_publication': 'Marketing Dive', + 'expected_type': DiveEmailTypes.QuarterBlast, + 'comment': 'Marketing Dive Quarter Blast with param-type blast name', + }, # You can pull the data for these tests from sailthru_tools scripts/get_campaign.py ]