Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 15 additions & 2 deletions Doppler.ReportingApi/Infrastructure/CampaignRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ FROM dbo.usertimezone timezone
,dateadd(MINUTE, @timezone, RPT.[UTCScheduleDate]) AS [UTCScheduleDate]
,RPT.[FromEmail]
,RPT.[CampaignType]
,RPT.[IdTestAB]
,SUM(RPT.[Subscribers]) [Subscribers]
,SUM(RPT.[Sent]) [Sent]
,CASE
Expand Down Expand Up @@ -176,6 +177,7 @@ END AS [SpamRate]
,C.[UTCScheduleDate]
,C.[FromEmail]
,C.[CampaignType]
,C.[IdTestAB]
,ISNULL(C.[AmountSentSubscribers],0) [Subscribers]
,(ISNULL(C.[DistinctOpenedMailCount],0) + ISNULL(C.[UnopenedMailCount],0)) AS [Sent]
,ISNULL(C.[DistinctOpenedMailCount],0) [Opens]
Expand Down Expand Up @@ -226,7 +228,12 @@ AND C.[Status] IN (5,9)
AND (@startDate IS NULL OR C.[UTCScheduleDate] >= @startDate)
AND (@endDate IS NULL OR C.[UTCScheduleDate] <= @endDate)
AND (@campaignName IS NULL OR LOWER(LTRIM(RTRIM(C.[Name]))) LIKE '%' + LOWER(LTRIM(RTRIM(@campaignName))) + '%')
AND (@campaignType IS NULL OR C.[CampaignType] LIKE @campaignType)
AND (
@campaignType IS NULL
OR (LTRIM(RTRIM(@campaignType)) = '')
OR (@campaignType = 'TEST_AB' AND C.IdTestAB IS NOT NULL)
OR (C.CampaignType = @campaignType AND C.IdTestAB IS NULL)
)
AND (@fromEmail IS NULL OR LOWER(LTRIM(RTRIM(C.[FromEmail]))) LIKE LOWER(LTRIM(RTRIM(@fromEmail))))
AND C.[IdTestCampaign] IS NULL
AND C.[IdScheduledTask] IS NULL
Expand All @@ -242,6 +249,7 @@ GROUP BY RPT.[IdUser]
,RPT.[UTCScheduleDate]
,RPT.[FromEmail]
,RPT.[CampaignType]
,RPT.[IdTestAB]
,RPT.[LabelName]
,RPT.[LabelColour]
ORDER BY RPT.[UTCScheduleDate] DESC
Expand Down Expand Up @@ -274,7 +282,12 @@ AND C.[Status] IN (5,9)
AND (@startDate IS NULL OR C.[UTCScheduleDate] >= @startDate)
AND (@endDate IS NULL OR C.[UTCScheduleDate] <= @endDate)
AND (@campaignName IS NULL OR LOWER(LTRIM(RTRIM(C.[Name]))) LIKE '%' + LOWER(LTRIM(RTRIM(@campaignName))) + '%')
AND (@campaignType IS NULL OR C.[CampaignType] LIKE @campaignType)
AND (
@campaignType IS NULL
OR (LTRIM(RTRIM(@campaignType)) = '')
OR (@campaignType = 'TEST_AB' AND C.IdTestAB IS NOT NULL)
OR (C.CampaignType = @campaignType AND C.IdTestAB IS NULL)
)
AND (@fromEmail IS NULL OR LOWER(LTRIM(RTRIM(C.[FromEmail]))) LIKE LOWER(LTRIM(RTRIM(@fromEmail))))
AND C.[IdTestCampaign] IS NULL
AND C.[IdScheduledTask] IS NULL
Expand Down
6 changes: 6 additions & 0 deletions Doppler.ReportingApi/Models/SentCampaignsMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public class SentCampaignMetrics
/// </summary>
public string CampaignType { get; set; }

/// <summary>
/// Identifier of the A/B test associated with the campaign.
/// Null or zero when the campaign is not part of an A/B test.
/// </summary>
public int? IdTestAB { get; set; }

/// <summary>
/// Total number of subscribers targeted by the campaign.
/// </summary>
Expand Down