refactor: improve downtime duration calculation in closure comment #387

This commit is contained in:
Raj Nandan Sharma
2025-04-29 21:20:04 +05:30
parent 92b4596924
commit cf33f5a2f6

View File

@@ -104,7 +104,7 @@ async function closeIncident(alert, comment) {
function createClosureComment(alert, commonJSON) {
let comment = "The incident has been auto resolved";
let downtimeDuration = moment(alert.updated_at).diff(moment(alert.created_at), "minutes");
let downtimeDuration = Math.round(moment(alert.updated_at).diff(moment(alert.created_at), "seconds") / 60);
comment = comment + `, Total downtime: ` + downtimeDuration + ` minutes`;
return comment;
}