From 91bf55dc2029b4b4be29fc43ee332a8df43f0179 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Thu, 4 Dec 2025 09:17:31 +0000 Subject: [PATCH] refactor: simplify logging for previous status duration and improve code formatting --- .../SendStatusChangeNotification.ts | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Worker/Jobs/MonitorOwners/SendStatusChangeNotification.ts b/Worker/Jobs/MonitorOwners/SendStatusChangeNotification.ts index 94a63a3ea6..7d9dff47be 100644 --- a/Worker/Jobs/MonitorOwners/SendStatusChangeNotification.ts +++ b/Worker/Jobs/MonitorOwners/SendStatusChangeNotification.ts @@ -126,7 +126,6 @@ RunCron( monitorStatusTimeline.startsAt || monitorStatusTimeline.createdAt; if (previousStartTime && currentStartTime) { - logger.debug( `Calculating duration between ${previousStartTime.toISOString()} and ${currentStartTime.toISOString()}`, ); @@ -141,10 +140,7 @@ RunCron( durationInSeconds, ); - - logger.debug( - `Previous status duration: ${previousStatusDuration}`, - ); + logger.debug(`Previous status duration: ${previousStatusDuration}`); } } } @@ -174,9 +170,10 @@ RunCron( for (const user of owners) { // Build the "Was X for Y" string - const previousStatusDurationText: string = previousStatus?.name && previousStatusDuration - ? `Was ${previousStatus.name} for ${previousStatusDuration}` - : ""; + const previousStatusDurationText: string = + previousStatus?.name && previousStatusDuration + ? `Was ${previousStatus.name} for ${previousStatusDuration}` + : ""; const vars: Dictionary = { monitorName: monitor.name!, @@ -216,22 +213,25 @@ RunCron( const emailMessage: EmailEnvelope = { templateType: EmailTemplateType.MonitorOwnerStatusChanged, vars: vars, - subject: `[Monitor] ${monitor.name || "Monitor" - } is ${monitorStatus!.name!}`, + subject: `[Monitor] ${ + monitor.name || "Monitor" + } is ${monitorStatus!.name!}`, }; const sms: SMSMessage = { - message: `This is a message from OneUptime. ${monitor.name || "Monitor" - } status changed${previousStatus ? ` from ${previousStatus.name}` : ""} to ${monitorStatus! - .name!}. To unsubscribe from this notification go to User Settings in OneUptime Dashboard.`, + message: `This is a message from OneUptime. ${ + monitor.name || "Monitor" + } status changed${previousStatus ? ` from ${previousStatus.name}` : ""} to ${monitorStatus! + .name!}. To unsubscribe from this notification go to User Settings in OneUptime Dashboard.`, }; const callMessage: CallRequestMessage = { data: [ { - sayMessage: `This is a message from OneUptime. ${monitor.name || "Monitor" - } status changed${previousStatus ? ` from ${previousStatus.name}` : ""} to ${monitorStatus! - .name!}. To unsubscribe from this notification go to User Settings in OneUptime Dashboard. Good bye.`, + sayMessage: `This is a message from OneUptime. ${ + monitor.name || "Monitor" + } status changed${previousStatus ? ` from ${previousStatus.name}` : ""} to ${monitorStatus! + .name!}. To unsubscribe from this notification go to User Settings in OneUptime Dashboard. Good bye.`, }, ], };