diff --git a/apps/server/src/Services/Notifications/SendNotifications.ts b/apps/server/src/Services/Notifications/SendNotifications.ts index b23b3d53..6ddf7b52 100644 --- a/apps/server/src/Services/Notifications/SendNotifications.ts +++ b/apps/server/src/Services/Notifications/SendNotifications.ts @@ -19,6 +19,7 @@ const sendNotifications = async (): Promise => { where: { isDelivered: false, sentAt: null, + alertMethod: {notIn: ['sms', 'whatsapp']} }, include: { siteAlert: { @@ -79,18 +80,18 @@ const sendNotifications = async (): Promise => { const siteName = site.name ? site.name : ''; const distanceKm = Math.round(distance / 1000); - let inout = `${distanceKm} km outside`; + let input = `${distanceKm} km outside`; if (distance == 0) { - inout = `inside`; + input = `inside`; } const checkLatLong = `Check ${latitude}, ${longitude} for fires.`; - const subject = `Likely fire ${inout} ${siteName} 🔥`; + const subject = `Likely fire ${input} ${siteName} 🔥`; - let message = `Detected ${inout} ${siteName} with ${confidence} confidence. ${checkLatLong}`; + let message = `Detected ${input} ${siteName} with ${confidence} confidence. ${checkLatLong}`; if (distance == 0) { - message = `Detected ${inout} ${siteName} with ${confidence} confidence. ${checkLatLong}`; + message = `Detected ${input} ${siteName} with ${confidence} confidence. ${checkLatLong}`; } const url = `https://firealert.plant-for-the-planet.org/alert/${alertId}`; @@ -114,7 +115,7 @@ const sendNotifications = async (): Promise => { timeZone: localTimeObject.timeZone, }); - message = `

A likely fire was detected at ${localEventDate} ${inout} ${siteName} with ${confidence} confidence

+ message = `

A likely fire was detected at ${localEventDate} ${input} ${siteName} with ${confidence} confidence

${checkLatLong}