Currently developing a "Timeblocks" style application for university. The main concept involves having a list of subtasks, each with a specified time limit. The goal is to iterate through these tasks, utilizing a timer to countdown the allocated time and then moving on to the next task. For example:
var todos = [
{ id: 1, task: "Finance", time: 1 },
{ id: 2, task: "Distribution", time: 1 },
{ id: 3, task: "Blah", time: 1 }
];
The above tasks would be iterated through, with a 1-minute countdown displayed in the console.
While I have successfully coded the core functionality, the countdown is not working correctly after the initial iteration. It seems to be counting down twice per second and then never stopping, eventually going into negative time. The interval should clear each time the timer reaches 0 and then restart when the next iteration begins.
Any assistance would be greatly appreciated.
P.S. I am also aware that the first iteration takes 1 minute to start, and I plan to address this issue as well!
Check out the code on StackBlitz here.