Commit 6e270e4 1 parent 248b538 commit 6e270e4 Copy full SHA for 6e270e4
File tree 1 file changed +10
-12
lines changed
1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,14 @@ export class WorkoutManager implements WorkoutManagerI {
139
139
return this . _sessionId ;
140
140
}
141
141
142
+ computeTimeLeft ( ) {
143
+ if ( this . _timer ?. remainingTime ) {
144
+ this . _timeLeft = this . _timeFromBeginningOfSet + this . _timer . remainingTime ;
145
+ } else {
146
+ this . _timeLeft = this . timeFromBeginningOfSet ;
147
+ }
148
+ }
149
+
142
150
async startWorkout ( ) {
143
151
if ( this . started ) return ;
144
152
if ( ! this . ready ) return ;
@@ -255,15 +263,7 @@ export class WorkoutManager implements WorkoutManagerI {
255
263
) ,
256
264
) ;
257
265
258
- if ( this . _timer ?. totalTime ) {
259
- this . _timeLeft =
260
- this . _timeFromBeginningOfSet -
261
- ( this . _timer . totalTime - this . _timer . remainingTime ) ;
262
- } else {
263
- this . _timeLeft = this . timeFromBeginningOfSet ;
264
- }
265
-
266
- // this._timeLeft = this._timeFromBeginningOfSet;
266
+ this . computeTimeLeft ( ) ;
267
267
this . _playedThreeSecondSound = false ;
268
268
await this . refresh ( ) ;
269
269
}
@@ -285,9 +285,7 @@ export class WorkoutManager implements WorkoutManagerI {
285
285
onTimerTick ( ) {
286
286
if ( this . _timer && this . dispatch ) {
287
287
const state = this . _timer . state ( ) ;
288
- this . _timeLeft =
289
- this . _timeFromBeginningOfSet -
290
- ( this . _timer . totalTime - this . _timer . remainingTime ) ;
288
+ this . computeTimeLeft ( ) ;
291
289
if ( state . remainingTime <= 4000 && ! this . playedThreeSecondSound ) {
292
290
if ( soundPlayer ) {
293
291
soundPlayer . play ( ) ;
You can’t perform that action at this time.
0 commit comments