diff --git a/Sources/com.morphclue.wakatime.sdPlugin/main.js b/Sources/com.morphclue.wakatime.sdPlugin/main.js index 2b784cf..86af8de 100644 --- a/Sources/com.morphclue.wakatime.sdPlugin/main.js +++ b/Sources/com.morphclue.wakatime.sdPlugin/main.js @@ -123,11 +123,7 @@ function setTitle(title) { } function calculateRemainingMinutes(durations, minutesToReach) { - let workedSeconds = 0; - for (const value of durations) { - workedSeconds += value.duration; - } - + const workedSeconds = durations.reduce((total, value) => total + value.duration, 0); const remainingTime = minutesToReach - Math.floor(workedSeconds / 60); return remainingTime > 0 ? remainingTime : 0; }