bdauer / tasktracker

tracker for one-off, timed and recurring tasks scheduled for or due on a given day.
2 stars 0 forks source link

Pause a timed task when the stop button is clicked. #29

Closed bdauer closed 7 years ago

bdauer commented 7 years ago

Starting and stopping a timed task are now working, both in the frontend timer and in the database via ajax request.

I added a stop method to the CountdownTimer in countdowntimer.js that sets running to false and empties the tickFtns array.

In countdowntimedtask.js, the postAjaxRequest function posts the name of the clicked button and the id.

In tracktasks/views.py I retrieve the name. If it's start_timer I set the start time to the current time. If it's stop_timer I set the elapsed time to the current time minus the start time and set the start time to none.