Currently I am using a timer on a page that is displayed to count how many seconds a machine has been down. The timer was built with this tutorial:
In essence, it uses the current date and time in the real world as well as the current date and time which starts when you click a start button (by set states elemental action).
However, every time I leave the page and come back the timer resets and there are no actions that reset any data that involves this. So I was wondering how can I make that time keep running whilst im on other pages of the app.
Below are screenshots of a more in depth view of how the timer I built works.
Unfortunately the end times are not known, as in my scenario when a machine is fixed and up and running would be the end time. As of then the start time is when they first report it and the stopwatch keeps ticking up per second.
Is it safe to assume there is no way around this issue?
Basically the issue is that I have a stopwatch counting up on my downtime page, and would like that to keep running whilst navigating other pages. Currently, if I leave the downtime page and return back to it, the stopwatch resets back to 0 (which makes sense cause the start time is set to the page’s date/time once loaded).
The application for this feature in this scenario is when a machine goes down, the machine operator comes to this downtime page and the stopwatch starts ticking up to keep track of how long the machine is down for. Once the machine is repaired, they click a submit button and the time displayed for how long it took the machine to be back up and running (from when it was down) is submitted to a database.
Again the issue is whilst the machine operator is on this downtime page with the stopwatch running, they may need to navigate to other pages on the app to do other things whilst the machine is down, but once they leave the page that stopwatch resets. Is there a way for the machine operator to navigate other pages of the app, then come back to the downtime page without the stopwatch resetting back to 0?
Apologies I have explained that bit poorly, the start time is when the button start is clicked on a popup when the page is loaded as seen per the screenshot below…
But when I load the page as seen per the screenshot the timer is still reset to 0m 0s.
Just incase should I share my bubble editor on here for a better understanding? Apologies for any poor explanation again still kinda new to bubble.
So I save the start time into a database? and when the page is reloaded do I use a “search for” function to find the start time in the database and use that as the subtraction of the current time?
If I manage it to calculate the differences when reloading the page can I still manage it to keep ticking up per second when the page is loaded with the calculated time differences?
E.g. Page is loaded, it does the current time - start time, (then the hard part for me at least) every 1 second it keeps updating that calculated time?
@adamhholmes@firstfifteensoftware
I did it! Thanks to all your help!
I really wish you guys were there to explain to me the first time I watched Interstellar cause I would’ve understood it the first time.
Thank you both so much appreciate the help
Read the entire thread and I have a problem the method above doest solve (I think)
My stopwatch works exactly like described above so every time the user refreshes the page - the stopwatch count the diff and shows the correct time count
My app is wrapped as native. My problem is for situation where the user minimizes the app and then re-opens it. In those cases the stopwatch continues the count from where it last stopped stopped before minimizing the app…
I guess It acts like this because the current date/time is not updated after mibimizing the app because it does.not require a refresh of the page unlike on a browser?