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.
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
incountdowntimer.js
that setsrunning
to false and empties thetickFtns
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'sstart_timer
I set the start time to the current time. If it'sstop_timer
I set the elapsed time to the current time minus the start time and set the start time to none.