Skip to content

Commit

Permalink
refactor: workedSeconds reduce
Browse files Browse the repository at this point in the history
Morphclue committed Jan 21, 2024
1 parent f589397 commit f60371f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Sources/com.morphclue.wakatime.sdPlugin/main.js
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit f60371f

Please sign in to comment.