Skip to content

Commit

Permalink
chore: Calculate click rate based on open events
Browse files Browse the repository at this point in the history
  • Loading branch information
diego3g committed Aug 9, 2021
1 parent 5acdf78 commit d782cd5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/modules/broadcasting/mappers/MessageStatsMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class MessageStatsMapper {
recipientsCount: raw.DELIVER,
clickCount: raw.CLICK,
openRate: Number(((raw.OPEN * 100) / raw.DELIVER).toFixed(2)),
clickRate: Number(((raw.CLICK * 100) / raw.DELIVER).toFixed(2)),
clickRate: Number(((raw.CLICK * 100) / raw.OPEN).toFixed(2)),
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('Get Message Stats', () => {
})

expect(response.clickCount).toBe(1)
expect(response.clickRate).toBe(33.33)
expect(response.clickRate).toBe(50)
expect(response.openRate).toBe(66.67)
expect(response.recipientsCount).toBe(3)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('Get Message Stats (e2e)', () => {
recipientsCount: 3,
openRate: 66.67,
clickCount: 1,
clickRate: 33.33,
clickRate: 50,
})
})
})

0 comments on commit d782cd5

Please sign in to comment.