mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: enhance code readability by adding comments for previous status duration calculation
This commit is contained in:
@@ -115,11 +115,15 @@ RunCron(
|
||||
},
|
||||
});
|
||||
|
||||
// Calculate how long the monitor was in the previous status
|
||||
// Use startsAt if available, otherwise fall back to createdAt
|
||||
const previousStartTime: Date | undefined = previousTimeline.startsAt || previousTimeline.createdAt;
|
||||
const currentStartTime: Date | undefined = monitorStatusTimeline.startsAt || monitorStatusTimeline.createdAt;
|
||||
|
||||
/*
|
||||
* Calculate how long the monitor was in the previous status
|
||||
* Use startsAt if available, otherwise fall back to createdAt
|
||||
*/
|
||||
const previousStartTime: Date | undefined =
|
||||
previousTimeline.startsAt || previousTimeline.createdAt;
|
||||
const currentStartTime: Date | undefined =
|
||||
monitorStatusTimeline.startsAt || monitorStatusTimeline.createdAt;
|
||||
|
||||
if (previousStartTime && currentStartTime) {
|
||||
const durationInSeconds: number =
|
||||
OneUptimeDate.getDifferenceInSeconds(
|
||||
|
||||
Reference in New Issue
Block a user