Skip to content

Commit c574c58

Browse files
committed
chore(emails): Minor improveso for loyalty points emails handler
1 parent bebaf8f commit c574c58

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/apps/emails/src/cron-points-emails.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const sendPointsEmails = async () => {
99
return;
1010
}
1111
const startDate = new Date();
12-
startDate.setDate(startDate.getDate() + 1);
12+
startDate.setHours(startDate.getHours() + 8);
1313
const endDate = new Date();
1414
endDate.setDate(endDate.getDate() + 10);
1515
const {
@@ -45,7 +45,12 @@ const sendPointsEmails = async () => {
4545
if (!validThruTime) return false;
4646
return validThruTime >= startDateTime && validThruTime <= endDateTime;
4747
});
48-
if (!activePoints?.length) continue;
48+
if (!activePoints?.length) {
49+
logger.warn(`Customer ${customer._id} skipped with no active points`, {
50+
customer,
51+
});
52+
continue;
53+
}
4954
const pointsToExpire = activePoints.reduce((acc, pointsEntry) => {
5055
return acc + pointsEntry.active_points;
5156
}, 0);
@@ -60,8 +65,8 @@ const sendPointsEmails = async () => {
6065
Compre em nossa loja com desconto usando os
6166
<b>${pointsToExpire} pontos</b>
6267
ativos na sua conta.
63-
Aproveite enquanto os pontos estão disponíveis,
64-
<b>seus pontos estão expirando nos próximos dias!</b>
68+
<b>Seus pontos estão expirando</b>,
69+
aproveite enquanto disponíveis!
6570
`,
6671
'button_text': 'Usar meus pontos',
6772
'button_link': `https://${store.domain}/`

0 commit comments

Comments
 (0)