Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sagararyal committed Dec 23, 2024
2 parents 7025f6a + 1720202 commit cba2786
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions apps/server/src/Services/Notifications/SendNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const sendNotifications = async (): Promise<number> => {
where: {
isDelivered: false,
sentAt: null,
alertMethod: {notIn: ['sms', 'whatsapp']}
},
include: {
siteAlert: {
Expand Down Expand Up @@ -79,18 +80,18 @@ const sendNotifications = async (): Promise<number> => {
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}`;

Expand All @@ -114,7 +115,7 @@ const sendNotifications = async (): Promise<number> => {
timeZone: localTimeObject.timeZone,
});

message = `<p>A likely fire was detected at ${localEventDate} ${inout} ${siteName} with ${confidence} confidence </p>
message = `<p>A likely fire was detected at ${localEventDate} ${input} ${siteName} with ${confidence} confidence </p>
<p>${checkLatLong}</p>
Expand Down

0 comments on commit cba2786

Please sign in to comment.