Closed KatieWoe closed 3 months ago
This can be fixed by removing this section from the code which accounts for elapsed time while the user was on the level selection screen. In removing this part, the timer only runs when the user is on a scene, which I thought was the desired timer behaviour. https://github.com/phetsims/arithmetic/blob/4d0a4cd8630448b33499b0debdb37e87010f8195/js/common/model/ArithmeticModel.js#L342-L349
However, I am a bit confused about the desired timer behaviour since in the published version it seems the timer is always running even when you are not a scene and it only stops once a level is completed or refreshed. Is that the behaviour we are aiming for?
Looking back at the history in #76, #59, #39, and #9 it seems as if that was the desired behaviour. If this is the case, then I believe the issue here is that the timer stops running when you go to another tab in your browser.
@amanda-phet could you weigh on on what timer behaviour we are aiming for? So it only runs when on a scene or so it runs all the time once a level has begun.
I agree that it seems like the timer is behaving as desired. If there is a precedent for a different timer behavior, that might help us resolve what's going on here. @KatieWoe do you know if other sims have a timer behavior that would make more sense for this sim?
My inclination is to leave this as-is since it's doing exactly what people wanted in those previous issue discussions.
I really don't know off the top of my head if there is a standard behavior. It's a bit odd, and I only caught it because I switching tabs to read emails and use github and happened to notice.
During yesterday's standup with @KatieWoe, we discussed the importance of consistency regarding the game timer in the arithmetic PhET sim. In the current published version, the timer operates continuously in the background, which we aim to maintain.
However, in reviewing other sims using a game timer, in most cases, the timer only runs while the user is actively in the scene. This behavior is consistent across sims where the "Back" button functions as a "Start over" button to switch levels.
The exception to this pattern is the Fractions sims, which also have a back button similar to the Arithmetic sim. But even in these sims, the timer only runs when the user is in a scene. Maybe maintaining uniformity across all sims by having the timer run exclusively while users are on scene interaction is the approach we want to take. @amanda-phet What are your thoughts on this?
I like consistency! So that sounds great to me.
The timer now runs only when a user is on a scene. Even though this behaviour is different from what's published, it maintains uniformity across all sims now.
Test device Dell Operating System Win 11 Browser Chrome Problem description For https://github.com/phetsims/qa/issues/1046. This does not seem to happen in published. If the timer is running on a scene that you are not on but previously started, it will continue to run if you are not on that scene. If you are on another tab of your browser, whether the timer runs depends on if you were in the scene or not when you switched tabs. If you were on the scene, the timer pauses until you return to the tab. If not, the timer continues running. Steps to reproduce
Troubleshooting information: