@@ -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